Files
clearml-web/src/app/shared/utils/url.ts
shyallegro 34f2167598 Release v1.13 (#64)
Co-authored-by: shallegro <shay@allego.ai>
2023-11-17 10:24:49 +02:00

18 lines
449 B
TypeScript

import {HTTP} from '~/app.constants';
export const isFileserverUrl = (url: string) =>
url?.startsWith(HTTP.FILE_BASE_URL);
export const convertToReverseProxy = (url: string) => {
try {
const u = new URL(url);
if (!u.pathname.startsWith('/files')) {
u.protocol = window.location.protocol;
u.host = window.location.host;
u.pathname = 'files' + u.pathname;
return u.toString();
}
} catch {}
return url;
};