Merge pull request #61 from public-awesome/fix-reversed-metadata-order

Fix: metadata gets sorted in reverse on some browsers
This commit is contained in:
Serkan Reis 2022-11-08 16:09:47 +03:00 committed by GitHub
commit bac11411c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,6 +144,7 @@ export const UploadDetails = ({ onChange }: UploadDetailsProps) => {
if (!e.target?.result) return toast.error('Error parsing file.')
if (!event.target.files) return toast.error('No files selected.')
const metadataFile = new File([e.target.result], event.target.files[i].name, { type: 'application/json' })
files.push(metadataFile)
try {
const parsedMetadata = JSON.parse(await metadataFile.text())
if (!parsedMetadata || typeof parsedMetadata !== 'object') {
@ -156,7 +157,6 @@ export const UploadDetails = ({ onChange }: UploadDetailsProps) => {
setMetadataFilesArray([])
return toast.error(`Invalid metadata file: ${metadataFile.name}`)
}
files.push(metadataFile)
}
reader.readAsText(event.target.files[i], 'utf8')
reader.onloadend = () => {