MCPcopy Index your code
hub / github.com/simstudioai/sim / buildFileSourceUrl

Function buildFileSourceUrl

apps/sim/connectors/gitlab/gitlab.ts:274–288  ·  view source on GitHub ↗

* 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
)

Source from the content-addressed store, hash-verified

272 * Builds the web UI URL for a repository file at a given ref.
273 */
274function 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

Callers 3

treeEntryToStubFunction · 0.70
skippedForSizeFunction · 0.70
fileToDocumentFunction · 0.70

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected