Open degregar opened 3 years ago
OK, I've fixed the issue on my side, although I think you should check it on your side as well.
The solution is this: before passing it to the upload
method, I remove the type
of the file.
const unfreezedFile = new File([file], file.name, {
type: undefined,
})
The browser incorrectly recognized the mime type, passed it to filestack
and, apparently, filestack
trusted the input.
I've tested that as well on the EPS file (can't attach it), which was recognized by the browser as image/x-eps
(uploaded file couldn't be transformed into PNG). In my integration tests I was passing just an URL, and filestack
recognized it as application/postscript
, and it worked fine.
What about renaming a .exe file to .mp4 or to other extensions. How to validate a exe file then.
Another case: browser was recognizing .ai
files as application/illustrator
, Filestack was recognizing them as application/illustrator
as well. If I removed the type, as described above, I got:
application/postscript
for a file saved as version 8application/pdf
for files saved as version 9+It's kinda correct according to this topic: https://community.adobe.com/t5/illustrator/pdf-vs-ai/m-p/9710802#M87037
V8 was kind of a postscript structure, while V9+ has the structure of a PDF file.
Although wouldn't be better to recognize it correctly as application/illustrator
? I guess Filestack, as an expert in handling image files, could access those hidden / private Illustrator's data.
This really helped actually
Our users sometimes send JPG files with PNG extension (or vice versa). The filestack API fails to detect it. It seems that it's based on extension, which is wrong.
Expected Behavior
If we send
example-jpg.png
(which is JPG) we want to getimage/jpeg
mime type.Current Behavior
We get
image/png
instead.Steps to Reproduce (for bugs)
cURL REQUEST
cURL response:
Example file (JPG really):![example-jpg](https://user-images.githubusercontent.com/7668271/124937325-912d7380-e007-11eb-89b4-d1dee48bc346.png)
How GIMP sees it:![gimp-correctly-detects-mime-type-of-jpg-file](https://user-images.githubusercontent.com/7668271/124937399-a73b3400-e007-11eb-9cef-e99d4f32abfd.png)