Add api prefix to attachment nodes

This commit is contained in:
Philipinho
2025-03-06 14:19:29 +00:00
parent a7dd9b9198
commit 16254802e3
6 changed files with 15 additions and 6 deletions

View File

@ -53,7 +53,16 @@ export function getSpaceUrl(spaceSlug: string) {
}
export function getFileUrl(src: string) {
return src?.startsWith("/files/") ? getBackendUrl() + src : src;
if (!src) return src;
if (src.startsWith("http")) return src;
if (src.startsWith("/api/")) {
// Remove the '/api' prefix
return getBackendUrl() + src.substring(4);
}
if (src.startsWith("/files/")) {
return getBackendUrl() + src;
}
return src;
}
export function getFileUploadSizeLimit() {