Skip to content
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

Attachment upload fails (unallowed MIME type application/octet-stream) #6332

Closed
4 tasks done
Kaemmelot opened this issue Aug 8, 2022 · 7 comments
Closed
4 tasks done
Labels
fixed Bugs that are fixed (in a coming release).

Comments

@Kaemmelot
Copy link

Kaemmelot commented Aug 8, 2022

Support guidelines

I've found a bug and checked that ...

Description

When uploading a certain PDF file to an existing transaction (the file extension and name don't matter) I get a success message, but the attachment is not visible in the transaction itself. When accessing /attachments the file is shown as 0 KB and not present. I found a hidden error on the /debug page but I don't know where this error originates from.

Expected behaviour

I would at least expect a visible message about this error. At best the file upload should just work.

Debug information

Debug information generated at 2022-08-08 19:29:56 Europe/Berlin for Firefly III version 5.7.10.

Scope Version
Firefly III 5.7.10
Firefly III API 1.5.6
Build (unknown), (unknown)
DB version 18 (exp. 18)
PHP 8.1.4
Host Linux
System info Value
System TZ Europe/Berlin
Browser TZ Europe/Berlin
App environment local
App debug mode false
App cache driver file
App logging notice, stack
Display errors Off
Error reporting ALL errors
Interface fpm-fcgi
Default language de_DE
Default locale equal
BCscale 24
DB drivers mysql
Current driver mysql
Trusted proxies (.env) ``
User info Value
Login provider eloquent
User guard web
Headers N/A, N/A
Stateful domains
Session start 2022-08-01 00:00:00
Session end 2022-08-31 23:59:59
Session first 2022-02-01 00:00:00
User ID 1
User language de_DE
User locale de_DE
Attempt at "de_DE.utf8" 'de_DE.utf8'
Attempt at "de_DE.UTF-8" 'de_DE.UTF-8'
User agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Truncated from this point <----|[2022-08-08 19:13:23] local.ERROR: Mime type application/octet-stream is not allowed for API file upload.  
[2022-08-08 19:13:43] local.ERROR: Mime type application/octet-stream is not allowed for API file upload.  
[2022-08-08 19:15:25] local.ERROR: Mime type application/octet-stream is not allowed for API file upload.  
[2022-08-08 19:16:05] local.ERROR: Mime type application/octet-stream is not allowed for API file upload.  
[2022-08-08 19:22:04] local.ERROR: Mime type application/octet-stream is not allowed for API file upload.  
[2022-08-08 19:22:38] local.ERROR: Mime type application/octet-stream is not allowed for API file upload.  
[2022-08-08 19:29:13] local.ERROR: Mime type application/octet-stream is not allowed for API file upload.  
[2022-08-08 19:29:52] local.ERROR: Mime type application/octet-stream is not allowed for API file upload.  

Steps to reproduce

No response

Additional info

I cannot upload the PDF file in this issue because it contains private data. If I can debug something for you tell me. In case you really need it, I could send you the PDF in private.

@JC5
Copy link
Member

JC5 commented Aug 8, 2022

I have no troubles uploading PDF files myself. What's your setup like?

@Kaemmelot
Copy link
Author

Kaemmelot commented Aug 8, 2022

This is the first file I have trouble with, all others worked just fine (including multiple PDFs).

I'm running Debian 11.4, apache2 (2.4.54) with php8.1-fpm (8.1.4). I configured a new pool for firefly in php-fpm.
File size is 129 KB, php.ini defines:

file_uploads = On
post_max_size = 8M
upload_max_filesize = 2M

and even way bigger files than this strange PDF can be uploaded. I didn't change much besides the new pool.

I just checked the PDF file version: 1.4 (Acrobat 5.x)

@Kaemmelot
Copy link
Author

Some of the apache site configuration:

Protocols h2 http/1.1
RewriteEngine On
SSLEngine on
# SSLCertificate configured

Alias /firefly/ /var/www/firefly/public/
<Directory /var/www/firefly>
        Require all granted
        Options SymLinksIfOwnerMatch
        AllowOverride FileInfo AuthConfig Limit Options=All,MultiViews
        FileETag All

        <IfModule proxy_fcgi_module>
                # Enable http authorization headers
                <IfModule setenvif_module>
                        SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
                </IfModule>
                <FilesMatch ".+\.ph(ar|p|tml)$">
                        SetHandler "proxy:unix:/run/php/php8.1-fpm-firefly.sock|fcgi://localhost"
                </FilesMatch>
        </IfModule>
</Directory>

@Kaemmelot
Copy link
Author

I found the difference for this PDF. I opened it in Notepad++ and found this:

-------------------------------28947758029299
Content-Disposition: form-data; name="censored.pdf"; filename="censored.pdf"
Content-Type: application/x-gzip

%PDF-1.4

I have never seen a gziped PDF.

@JC5
Copy link
Member

JC5 commented Aug 8, 2022

Neither did I lol. I did discover another issue with uploads. I'll mark it as such and pick it up!

@JC5 JC5 added the bug label Aug 8, 2022
@Kaemmelot
Copy link
Author

In case someone else stumbles upon this later on and searches for a solution:
I fixed my problem by converting the PDF. I used the Adobe compress tool with minimal compression.

@JC5 JC5 added this to the next-minor milestone Aug 14, 2022
@JC5 JC5 added this to Firefly III Aug 14, 2022
@JC5 JC5 moved this to Ready in Firefly III Aug 14, 2022
@JC5 JC5 added the fixed Bugs that are fixed (in a coming release). label Sep 11, 2022
@JC5 JC5 closed this as completed in cf8957a Sep 11, 2022
Repository owner moved this from Ready to Done in Firefly III Sep 11, 2022
@github-actions
Copy link
Contributor

Hi there! This is an automatic reply. Share and enjoy

This issue is now closed. Please be aware that closed issues are not actively monitored. If you reply, you may get no response.

  • If the original bug is not actually fixed, please feel free to open a new ticket. Please refer to this issue for clarity.
  • Follow-up questions can also be posted in a new discussion

Thank you for your consideration.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed Bugs that are fixed (in a coming release).
Projects
Archived in project
Development

No branches or pull requests

2 participants