diff --git a/in-app/v1/src/utils/useUpload.ts b/in-app/v1/src/utils/useUpload.ts index 3327080a6..d7f2a262c 100644 --- a/in-app/v1/src/utils/useUpload.ts +++ b/in-app/v1/src/utils/useUpload.ts @@ -44,7 +44,7 @@ export function useUpload({ onError }: UseUploadOptions = {}): UseUploadResult { const fileInfo: FileInfo = { key, name: file.name, - url: URL.createObjectURL(file), + url: createObjectURL(file), progress: 0, }; @@ -80,7 +80,7 @@ export function useUpload({ onError }: UseUploadOptions = {}): UseUploadResult { .then((file) => { update({ id: file.id, - // url: file.url, + url: fileInfo.url ?? file.url, mime: file.mime, progress: undefined, }); @@ -102,3 +102,9 @@ export function useUpload({ onError }: UseUploadOptions = {}): UseUploadResult { return { files, isUploading: uploadingCount > 0, upload, remove, removeAll }; } + +function createObjectURL(obj: Blob) { + if (typeof URL === 'function' && typeof URL.createObjectURL === 'function') { + return URL.createObjectURL(obj); + } +}