diff --git a/test/test-parse-source-urls.js b/test/test-parse-source-urls.js index 5662a077a..98dec45aa 100644 --- a/test/test-parse-source-urls.js +++ b/test/test-parse-source-urls.js @@ -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}`); } +{ + 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'); assert(result.isValid === true, 'SSH protocol URL without custom port remains valid'); diff --git a/tools/installer/modules/custom-module-manager.js b/tools/installer/modules/custom-module-manager.js index 5c47d0d8f..6a4b68be6 100644 --- a/tools/installer/modules/custom-module-manager.js +++ b/tools/installer/modules/custom-module-manager.js @@ -171,10 +171,12 @@ class CustomModuleManager { const repoSeg = segments.at(-1); const ownerSeg = segments.at(-2); 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 { type: 'url', - cloneUrl: trimmed, + cloneUrl, subdir: null, localPath: null, version: versionSuffix || null,