This repository has no description
1import { resolve } from "$app/paths";
2
3// rest params arrive decoded, re-encode per segment or `#`/`?`/`%` corrupt
4// the url
5export const encodePathSegments = (path: string): string =>
6 path.split("/").map(encodeURIComponent).join("/");
7
8export const baseName = (path: string): string => path.split("/").pop() ?? path;
9
10export const rawBlobHref = (ownerHandle: string, repoName: string, ref: string, path: string) =>
11 resolve(
12 `/${ownerHandle}/${repoName}/raw/${encodeURIComponent(ref)}/${encodePathSegments(path)}` as "/"
13 );