MCPcopy
hub / github.com/github/awesome-copilot / getExternalPluginUrl

Function getExternalPluginUrl

website/src/scripts/modal.ts:1164–1173  ·  view source on GitHub ↗

* Get the best URL for an external plugin, preferring the deep path within the repo

(plugin: Plugin)

Source from the content-addressed store, hash-verified

1162 * Get the best URL for an external plugin, preferring the deep path within the repo
1163 */
1164function getExternalPluginUrl(plugin: Plugin): string {
1165 if (plugin.source?.source === "github" && plugin.source.repo) {
1166 const base = `https://github.com/${plugin.source.repo}`;
1167 return plugin.source.path && plugin.source.path !== "/"
1168 ? `${base}/tree/main/${plugin.source.path}`
1169 : base;
1170 }
1171 // Sanitize URLs from JSON to prevent XSS via javascript:/data: schemes
1172 return sanitizeUrl(plugin.repository || plugin.homepage);
1173}
1174
1175/**
1176 * Render modal content for an external plugin (no local files)

Callers 1

Calls 1

sanitizeUrlFunction · 0.90

Tested by

no test coverage detected