* Builds the web UI URL for a repository file at a given ref.
( apiBase: string, encodedProject: string, host: string, projectPath: string, ref: string, path: string )
| 272 | * Builds the web UI URL for a repository file at a given ref. |
| 273 | */ |
| 274 | function buildFileSourceUrl( |
| 275 | apiBase: string, |
| 276 | encodedProject: string, |
| 277 | host: string, |
| 278 | projectPath: string, |
| 279 | ref: string, |
| 280 | path: string |
| 281 | ): string { |
| 282 | const encodedPath = path.split('/').map(encodeURIComponent).join('/') |
| 283 | if (projectPath) { |
| 284 | const encodedRef = ref.split('/').map(encodeURIComponent).join('/') |
| 285 | return `https://${host}/${projectPath}/-/blob/${encodedRef}/${encodedPath}` |
| 286 | } |
| 287 | return `${apiBase}/projects/${encodedProject}/repository/files/${encodeURIComponent(path)}/raw?ref=${encodeURIComponent(ref)}` |
| 288 | } |
| 289 | |
| 290 | /** |
| 291 | * Builds a deferred stub for a repository file from a tree entry. Content is empty |
no test coverage detected