Closed fungiboletus closed 3 years ago
// @vladfrangu
Can you send me an AI PDF file please? You can attach it here, email it or send it on Discord if it's easier for you (Vladdy#0002)
I'll look into it as soon as I can! 😅
I installed Adobe Illustrator's trial and made a few test documents:
ai
normal.ai
ai
without-pdf-comptability.ai
ai
adobe-illustrator.pdf
pdf
smallest.pdf
pdf
fast-web.pdf
pdf
printed.pdf
Well it's good to know out of 6 cases, only one fails 😅 I'll look into it asap and let you know!
True, but it's the one with the default settings for PDF in Adobe Illustrator.
Hey! Sorry to keep you in the dark for 8 whole days, just shot a quick eye at the text using a text diff viewer. Running a diff between the fixture.ai
file present in the fixtures folder on this repository, and the adobe-illustrator.pdf
file from your archive yielded... A big middle finger from the metadata! However, I thing I spotted in the PDF is that there's this section of data:
Technically, this can be used to detect if this is, in the end, a PDF file. However, I don't know how many cans of worms this will also open up, as I'm not an active user of Adobe products. I can, however, attempt to implement a PR for this!
Any chance to get this fixed? Cause the console version from "file-type" is getting the correct file-type (it's using npm file-type v12.xx i think). I'm using file-type as upload validator so my only two options are i am allowing AI file types too or waiting for a bugfix for this :)
It's fixable but I have to mess around with it a lot cause of the way PDF files exist... Basically:
Ok, so for now i "just" also accept AI files and hope it will be fixed anytime :) I am not familiar with the code from the file-type package, but maybe i get some time to check this problem too... based on your three steps :)
However, will be cool to get this fixed :)
We've also encountered this same regression. We rely on the PDF detection functionality to validate specific PDF processing requests but as of file-type@14.1.0
this process breaks as file-type returns the files as .ai
(application/postscript
).
Is there a solution in mind here? I'd suggest it's more of a 'bug' than an 'enhancement' as it is falsely identifying one file type as another.
For now, we've pinned to 14.0.0
until this is resolved. We'll also look at submitting a PR if we can determine a nice fix on our side.
This appears to be back. I am currently using file-type@17.1.1 and PDFs exported from illustrator with similar parameters to @fungiboletus and it is improperly detecting it as a .ai file. @vladfrangu
Well the parsing was changed in #396 from what I did so I don't really know what the issue is. Best thing you can probably do is attach a file sample with the broken detection and someone will hopefully take a look
Well the parsing was changed in #396 from what I did so I don't really know what the issue is. Best thing you can probably do is attach a file sample with the broken detection and someone will hopefully take a look
@vladfrangu I can DM someone the file for testing, but would prefer to not share it in a public setting. Where should I send this?
Could you replicate the pdf with non-sensitive information? (also helps since it can be added as a text fixture in the repo)
Could you replicate the pdf with non-sensitive information? (also helps since it can be added as a text fixture in the repo)
Sure, let me generate something
Since #323 (src: Add support for AI files (Adobe Illustrator)),
file-type
looks for the text "Adobe Illustrator
" in PDF documents and if it matches, it assumes it's an adobe.ai
file.It seems that normal PDF created with Adobe Illustrator will contain the text "
Adobe Illustrator
" quite a few times in the metadata too, even though they are not Adobe Illustrator files.