mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
[WEB-310] regression: generate file url function (#5811)
* fix: generate file url function * chore: remove unused imports * chore: replace indexOf logix with startsWith
This commit is contained in:
committed by
GitHub
parent
7cc86ad4c0
commit
e404450e1a
@@ -1,6 +1,5 @@
|
||||
// helpers
|
||||
import { API_BASE_URL } from "@/helpers/common.helper";
|
||||
import { checkURLValidity } from "@/helpers/string.helper";
|
||||
|
||||
/**
|
||||
* @description combine the file path with the base URL
|
||||
@@ -9,7 +8,7 @@ import { checkURLValidity } from "@/helpers/string.helper";
|
||||
*/
|
||||
export const getFileURL = (path: string): string | undefined => {
|
||||
if (!path) return undefined;
|
||||
const isValidURL = checkURLValidity(path);
|
||||
const isValidURL = path.startsWith("http");
|
||||
if (isValidURL) return path;
|
||||
return `${API_BASE_URL}${path}`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user