Skip to content

Commit

Permalink
Revert "feat(in-app/v1): safe create object url"
Browse files Browse the repository at this point in the history
This reverts commit db374dc.
  • Loading branch information
sdjdd committed Mar 21, 2024
1 parent db374dc commit d000aaf
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions in-app/v1/src/utils/useUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function useUpload({ onError }: UseUploadOptions = {}): UseUploadResult {
const fileInfo: FileInfo<number> = {
key,
name: file.name,
url: createObjectURL(file),
url: URL.createObjectURL(file),
progress: 0,
};

Expand Down Expand Up @@ -80,7 +80,7 @@ export function useUpload({ onError }: UseUploadOptions = {}): UseUploadResult {
.then((file) => {
update({
id: file.id,
url: fileInfo.url ?? file.url,
// url: file.url,
mime: file.mime,
progress: undefined,
});
Expand All @@ -102,9 +102,3 @@ 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);
}
}

0 comments on commit d000aaf

Please sign in to comment.