-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF detected as application/octet-stream #285
Comments
For newline and BOM prefixed signatures. For #285
Hi, @peric Thank you for reporting this issue. It should be fixed. go get -u github.com/gabriel-vasile/[email protected] |
Hey there, it's me again 🙃 I stumbled upon similar example, so I'll mention it here instead of opening another issue (at least for now). Basically, the beginning of the source for the file provided above looks like this:
In the example I currently have, the source starts like this:
The file works typically when you try to open it with a PDF reader, although Is this also something that can be covered with a similar solution? Thanks in advance |
Hi @peric, mimetype/internal/magic/document.go Lines 9 to 10 in 6f575b3
Please show what is the output of running Also, it would help knowing details about how this PDF was created, like: |
Hey @gabriel-vasile, sorry for the late reply. The notification got lost somewhere and I forgot to provide you an answer. Also, we found a workaround in the meantime, so that's one more reason why I forgot to answer. The output of
And the output of
Hope that helps. |
Thank you, @peric! I generated some PDFs using Antenna House but couldn't reproduce the issue. I have one more question to you: what's the output of
If it is |
Attach the file for which the detection is inaccurate
Unfortunately, I am not able to share the original file, but I've tried to fake it and create a new one.
fake-pdf.pdf
Expected MIME type
application/pdf
Returned MIME type
application/octet-stream
Version of the library you are using
1.4.0
Output of
go version
go version go1.18.1 darwin/arm6
Additional context
As mentioned above, I am not able to share the real PDF file, but I've tried to fake it.
If you try to open the file above, you'll see just a blank document. But, if you open the source of that file, you'll see that
%PDF-1.4
is in the 2nd line and not in the 1st one. And this is exactly the same problem that I've found in my real PDF file - the only difference is that my real PDF file works locally (i.e. with Preview/MacOS) without any issues and the one I faked actually got blank after I moved the%PDF-1.4
to the 2nd line.Therefore, I understand that my file is kinda corrupted (although, the customer got it from some accounting system) but it also works locally without any issues. Although, when I try to send it through the
Detect
function, it returnsapplication/octet-stream
.Not sure if this is something that can or should be fixed, but let's see. Thanks in advance.
The text was updated successfully, but these errors were encountered: