Use globalThis instead of window for global object access (S7764)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -271,7 +271,7 @@ export const useFilesStore = defineStore("filesStore", {
|
||||
* @param {number} id - The file ID.
|
||||
*/
|
||||
async deleteFile(type, id) {
|
||||
if (id === null || id === undefined || isNaN(id)) {
|
||||
if (id === null || id === undefined || Number.isNaN(Number(id))) {
|
||||
console.error("Delete File API Error: invalid id");
|
||||
return;
|
||||
}
|
||||
@@ -317,13 +317,13 @@ export const useFilesStore = defineStore("filesStore", {
|
||||
const response = await apiClient.get(`${getFileApiBase(type, id)}/csv`);
|
||||
const csvData = response.data;
|
||||
const blob = new Blob([csvData], { type: "text/csv" });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const url = globalThis.URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
|
||||
link.href = url;
|
||||
link.download = `${fileName}.csv`;
|
||||
link.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
globalThis.URL.revokeObjectURL(url);
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to download.");
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ export const useLoginStore = defineStore("loginStore", {
|
||||
}
|
||||
// Only allow relative paths to prevent open redirect attacks
|
||||
if (decodedUrl.startsWith("/") && !decodedUrl.startsWith("//")) {
|
||||
window.location.href = decodedUrl;
|
||||
globalThis.location.href = decodedUrl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user