Closed tomjohnhall closed 2 years ago
Buckets pushPath sometimes throws this error:
Error: parsing event in validate write: SyntaxError: (anonymous): Line 1:339 Unexpected identifier (and 2 more errors)
It seems to happen on some jpg files, but I haven't yet been able to see any pattern in the files that fail.
Here's how I'm generating the buffer, basically identical to the docs:
const reader = new FileReader() reader.onabort = () => reject('file reading was aborted') reader.onerror = () => reject('file reading has failed') reader.onload = async () => { const binaryStr = reader.result if (binaryStr) { if (audio) { const duration = await this.getDuration(file) uploadData(binaryStr, duration) } else uploadData(binaryStr) } } reader.readAsArrayBuffer(file)
Where uploadData eventually calls buckets.pushPath(this.bucketKey, path, data)
uploadData
buckets.pushPath(this.bucketKey, path, data)
Anyone come across this or could point to where it might be originating?
Thanks!
Ah, doh! This is due to attempting to write files to paths with characters such as ' in the filename. Once I strip everything to alphanumeric, they work fine!
'
Buckets pushPath sometimes throws this error:
It seems to happen on some jpg files, but I haven't yet been able to see any pattern in the files that fail.
Here's how I'm generating the buffer, basically identical to the docs:
Where
uploadData
eventually callsbuckets.pushPath(this.bucketKey, path, data)
Anyone come across this or could point to where it might be originating?
Thanks!