fix(installer): normalize ssh custom-source clone urls
This commit is contained in:
parent
ea557079f0
commit
16ff771941
|
|
@ -220,6 +220,13 @@ console.log(`\n${colors.cyan}Simple owner/repo URLs (regression check)${colors.r
|
||||||
assert(result.displayName === 'path/repo', 'SSH protocol custom-port displayName uses last two segments', `Got: ${result.displayName}`);
|
assert(result.displayName === 'path/repo', 'SSH protocol custom-port displayName uses last two segments', `Got: ${result.displayName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const result = manager.parseSource('ssh://git@host:2222/path/repo.git?foo=bar#readme');
|
||||||
|
assert(result.isValid === true, 'SSH protocol URL with query and hash is valid');
|
||||||
|
assert(result.cloneUrl === 'ssh://git@host:2222/path/repo.git', 'SSH protocol cloneUrl drops query and hash', `Got: ${result.cloneUrl}`);
|
||||||
|
assert(result.cacheKey === 'host:2222/path/repo', 'SSH protocol query/hash cacheKey ignores query and hash', `Got: ${result.cacheKey}`);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const result = manager.parseSource('ssh://git@host/owner/repo.git');
|
const result = manager.parseSource('ssh://git@host/owner/repo.git');
|
||||||
assert(result.isValid === true, 'SSH protocol URL without custom port remains valid');
|
assert(result.isValid === true, 'SSH protocol URL without custom port remains valid');
|
||||||
|
|
|
||||||
|
|
@ -171,10 +171,12 @@ class CustomModuleManager {
|
||||||
const repoSeg = segments.at(-1);
|
const repoSeg = segments.at(-1);
|
||||||
const ownerSeg = segments.at(-2);
|
const ownerSeg = segments.at(-2);
|
||||||
const displayName = ownerSeg ? `${ownerSeg}/${repoSeg}` : repoSeg;
|
const displayName = ownerSeg ? `${ownerSeg}/${repoSeg}` : repoSeg;
|
||||||
|
const auth = url.username ? `${url.username}${url.password ? `:${url.password}` : ''}@` : '';
|
||||||
|
const cloneUrl = `${url.protocol}//${auth}${url.host}/${repoPath}`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'url',
|
type: 'url',
|
||||||
cloneUrl: trimmed,
|
cloneUrl,
|
||||||
subdir: null,
|
subdir: null,
|
||||||
localPath: null,
|
localPath: null,
|
||||||
version: versionSuffix || null,
|
version: versionSuffix || null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue