diff --git a/app/utils.ts b/app/utils.ts index c7664f171..c5107109b 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -19,7 +19,8 @@ export function trimTopic(topic: string) { export const readFileContent = async (file: UploadFile): Promise => { const host_url = new URL(window.location.href); - if (!file.url.includes(host_url.host)) { + const file_url = new URL(file.url); + if (file_url.host !== host_url.host) { throw new Error(`The URL ${file.url} is not allowed to access.`); } try {