append generated id to file name

This commit is contained in:
Han Tuerker
2022-11-16 11:15:10 +03:00
parent a3d22474c9
commit 969809df8b

View File

@@ -16,6 +16,7 @@ import { projectScope } from "@src/atoms/projectScope";
import { firebaseStorageAtom } from "@src/sources/ProjectSourceFirebase";
import { WIKI_LINKS } from "@src/constants/externalLinks";
import { FileValue } from "@src/types/table";
import { generateId } from "@src/utils/table";
export type UploadState = {
progress: number;
@@ -85,7 +86,7 @@ const useFirebaseStorageUploader = () => {
const storageRef = ref(
firebaseStorage,
`${docRef.path}/${fieldName}/${file.name}`
`${docRef.path}/${fieldName}/${generateId()}-${file.name}`
);
const uploadTask = uploadBytesResumable(storageRef, file, {
cacheControl: "public, max-age=31536000",