Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB-310] regression: generate file url function (#5811)

Aaryan Khandelwale404450e1a79
diff --git a/admin/helpers/file.helper.ts b/admin/helpers/file.helper.ts
index 627b3b7d09..6e1f546360 100644
--- a/admin/helpers/file.helper.ts
+++ b/admin/helpers/file.helper.ts
@@ -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}`;
};
diff --git a/space/helpers/file.helper.ts b/space/helpers/file.helper.ts
index fef071ed32..b149ebc7cf 100644
--- a/space/helpers/file.helper.ts
+++ b/space/helpers/file.helper.ts
@@ -2,7 +2,6 @@
import { TFileMetaDataLite, TFileSignedURLResponse } from "@plane/types";
// helpers
import { API_BASE_URL } from "@/helpers/common.helper";
-import { checkURLValidity } from "@/helpers/string.helper";
/**
* @description from the provided signed URL response, generate a payload to be used to upload the file
@@ -24,7 +23,7 @@ export const generateFileUploadPayload = (signedURLResponse: TFileSignedURLRespo
*/
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}`;
};
diff --git a/web/helpers/file.helper.ts b/web/helpers/file.helper.ts
index 32570da5bd..a64177a7ab 100644
--- a/web/helpers/file.helper.ts
+++ b/web/helpers/file.helper.ts
@@ -2,7 +2,6 @@
import { TFileMetaDataLite, TFileSignedURLResponse } from "@plane/types";
// helpers
import { API_BASE_URL } from "@/helpers/common.helper";
-import { checkURLValidity } from "@/helpers/string.helper";
/**
* @description from the provided signed URL response, generate a payload to be used to upload the file
@@ -24,7 +23,7 @@ export const generateFileUploadPayload = (signedURLResponse: TFileSignedURLRespo
*/
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}`;
};