253
const gitSuffix = '.git';
254
const pathHasGitSuffix = trimmedPath.toLowerCase().endsWith(gitSuffix);
255
>
const pathWithoutGit = pathHasGitSuffix ? trimmedPath.slice(0, trimmedPath.length - gitSuffix.length) : trimmedPath;
marketplaceReference.ts
256
>
const pathSegments = pathWithoutGit.split('/').map(sanitizePathSegment);
257
>
// Always normalize the canonical path to include .git so that URLs with and without the suffix deduplicate.
258
>
const canonicalPath = pathHasGitSuffix ? trimmedPath.toLowerCase() : `${trimmedPath.toLowerCase()}${gitSuffix}`;
259
>
260
>
// Extract githubRepo for GitHub URLs so the editor can render a clickable link
261
>
const githubRepo = extractGitHubRepo(uri.authority, pathWithoutGit);
262
>
263
>
// Normalize github.com/<owner>/<repo>[.git] URLs to the same canonical id
264
>
// the shorthand parser emits, so policy trust comparisons (which match by
265
>
// canonicalId) treat both forms as the same marketplace.
266
>
let canonicalId: string;
267
>
if (githubRepo) {
268
const [owner, repo] = githubRepo.split('/');
269
canonicalId = getGitHubCanonicalId(owner, repo, ref);