Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download src/utils/internalFetch.ts from lerobot/visualize_dataset: direct link, hf CLI and curl.
- Browser
- Download file 493 Bytes
-
https://huggingface.co/spaces/lerobot/visualize_dataset/resolve/refs%2Fpr%2F4/src/utils/internalFetch.ts
- Command line
-
hf download hf://spaces/lerobot/visualize_dataset@refs/pr/4/src/utils/internalFetch.ts
-
curl -L -o internalFetch.ts https://huggingface.co/spaces/lerobot/visualize_dataset/resolve/refs%2Fpr%2F4/src/utils/internalFetch.ts
493 Bytes
| /** | |
| * Server-side code (e.g. server actions) cannot use relative fetch URLs; prefix with the app origin. | |
| */ | |
| export function resolveInternalFetchUrl(url: string): string { | |
| if (typeof window !== "undefined") return url; | |
| if (url.startsWith("http://") || url.startsWith("https://")) return url; | |
| if (!url.startsWith("/")) return url; | |
| const base = | |
| process.env.NEXT_PUBLIC_APP_URL?.replace(/\/$/, "") ?? | |
| `http://127.0.0.1:${process.env.PORT ?? "3000"}`; | |
| return `${base}${url}`; | |
| } | |