akaunting / docker

Docker Image for Akaunting
https://github.com/akaunting/akaunting
GNU General Public License v3.0
184 stars 86 forks source link

File upload size and different mime issue #108

Closed robertalexa closed 9 months ago

robertalexa commented 9 months ago

Hi @denisdulici

Firstly I apologise for tagging you directly, I know this is not good manners, but I have seen you reply to a similar issue on the main repository and I've figured you may be my best bet.

I am currently experiencing two issues:

  1. Upload file size

In my run.env file I have set FILESYSTEM_MAX_SIZE=10 as per your suggestion.

Once I've restarted the container, I am "able" to upload the file - in the sense that I am not seeing the error message anymore.

How when I actually save the transaction I am getting a "silent" failure. Inspecting the network requests I see: image image

To test if the variable trully functions I have added a custom MIME type to also support csv FILESYSTEM_MIMES="pdf,jpeg,jpg,png,csv" - and this leads me to the second issue.

  1. Custome file MIME

I am now trying to upload a csv file - the file explorer allows seeing csv files. I am then "able" to upload them.

However, again, when saving the transaction I am getting the following error: image

As you can see, csv is a file MIME in the list of allowed ones.

I then went a bit further and connected to the docker container and checked the .env file there. By the looks of it, env variables from the original setup are present, but nothing relating to FILESYSTEM_MAX_SIZE or FILESYSTEM_MIMES.

Here is a redacted version of my run.env file:

# You should change this to match your reverse proxy protocol, DNS name and port (if non standard port is used)
APP_URL=REDACTED
LOCALE=en-US

# Don't change this unless you rename your database container or use rootless podman, in case of using rootless podman you should set it to 127.0.0.1 (NOT localhost)
DB_HOST=akaunting-db
DB_PORT=3306

# Change these to match env/db.env
DB_NAME=akaunting
DB_USERNAME=admin
DB_PASSWORD=REDACTED

# You should change this to a random string of three numbers or letters followed by an underscore
DB_PREFIX=aka_

# These define the first company to exist on this instance. They are only used during setup.
COMPANY_NAME=REDACTED
COMPANY_EMAIL=REDACTED

# This will be the first administrative user created on setup.
ADMIN_EMAIL=REDACTED
ADMIN_PASSWORD=REDACTED

FILESYSTEM_MAX_SIZE=10
FILESYSTEM_MIMES="pdf,jpeg,jpg,png,csv"

And here is a redacted version of the .env file in the container:

APP_NAME=Akaunting
APP_ENV=production
APP_LOCALE="en-GB"
APP_INSTALLED=true
APP_DEBUG=false

DB_CONNECTION=mysql
DB_PORT=3306

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_CONNECTION=sync
LOG_CHANNEL=stderr

MAIL_MAILER="sendmail"
MAIL_HOST=""
MAIL_PORT=""
MAIL_USERNAME=""
MAIL_PASSWORD=""
MAIL_ENCRYPTION=""
MAIL_FROM_NAME="REDACTED"
MAIL_FROM_ADDRESS="REDACTED"

FIREWALL_ENABLED=true

MODEL_CACHE_ENABLED=true

DB_HOST=akaunting-db
DB_DATABASE=akaunting
DB_USERNAME=admin
DB_PASSWORD="REDACTED"
DB_PREFIX=aka_
APP_KEY=base64:REDACTED

Happy to provide any other info required.

Any help would be greatly appreciated!

Setup info: rpi4 docker using docker-compose.yml served by Nginx Proxy Manager over a public domain with SSL App version 3.1.5 on a brand new setup (currently trying to populate some of this years transactions)

Regards, Rob

robertalexa commented 9 months ago

To follow up on this:

I have manually introduced the 2 variables in the akaunting:/var/www/html/.env via docker cp and restarted the container. The behaviour remained unchanged to the above.

Also worth mentioning is that the upload functionality works for small file sizes, just as expected. So this is not a total failure of the upload systems.

image

robertalexa commented 9 months ago

For anyone else experiencing the same issue, FILESYSTEM_MAX_SIZE will only affect the validation size.

PHP value remains 2M. To adjust that, I have created myself the following structure: php-configs/custom.ini

upload_max_filesize = 10M

I have then mounted this location as a volume inside docker-compose.yml

./php-configs/custom.ini:/usr/local/etc/php/conf.d/custom.ini

image

As to the second issue, accepting csv, I have changed the value in the env to:

FILESYSTEM_MIMES="pdf,jpeg,jpg,png,csv,txt"

However this only deal with the validation side of things. The mediable package also contains a config that requires a change. I have created a PR on the main repository, feel free to replicate the code from there before (if) it gets merged.