* Get the best URL for an external plugin, preferring the deep path within the repo
(plugin: Plugin)
| 1162 | * Get the best URL for an external plugin, preferring the deep path within the repo |
| 1163 | */ |
| 1164 | function 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) |
no test coverage detected