Uploading a zip file under "files" in a project results in "invalid file"
Added by M WEI almost 6 years ago
As the titles says, uploading a zip file under "files" in a project results in "invalid file".
How do I fix this?
Replies (6)
RE: Uploading a zip file under "files" in a project results in "invalid file" - Added by Bernhard Rohloff almost 6 years ago
I can't reproduce the issue on my instance. Furthermore I think it makes sense for you to tell us more about your specific environment.
I don't know if its a permission problem but you could also take a glimpse at the file settings in the administrator section.
Kind regards,
Bernhard
RE: Uploading a zip file under "files" in a project results in "invalid file" - Added by M WEI almost 6 years ago
Environment:
Redmine version 4.0.1.stable
Ruby version 2.5.0-p0 (2017-12-25) [x86_64-linux]
Rails version 5.2.2
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery sendmail
SCM:
Git 2.7.4
Filesystem
Redmine plugins:
redmine_discord 0.0.1
Where can I find the logs to check if it throws any errors?
RE: Uploading a zip file under "files" in a project results in "invalid file" - Added by M WEI almost 6 years ago
Started GET "/projects/test/files/new" for xx.xx.xx.xx at 2019-02-13 08:21:50 +0100
Processing by FilesController#new as HTML
Parameters: {"project_id"=>"test"}
Current user: RedCat (id=1)
Rendering files/new.html.erb within layouts/base
Rendered attachments/_form.html.erb (6.0ms)
Rendered files/new.html.erb within layouts/base (14.7ms)
Completed 200 OK in 204ms (Views: 87.2ms | ActiveRecord: 92.4ms)
Started POST "/projects/test/files" for xx.xx.xx.xxat 2019-02-13 08:22:21 +0100
Processing by FilesController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"xx", "version_id"=>"1", "attachments"=>{"1"=>{"filename"=>"blabla.zip", "description"=>"", "token"=>""}}, "commit"=>"Add", "project_id"=>"test"}
Current user: RedCat (id=1)
Rendering files/new.html.erb within layouts/base
Rendered attachments/_form.html.erb (6.1ms)
Rendered files/new.html.erb within layouts/base (14.6ms)
Completed 200 OK in 148ms (Views: 86.9ms | ActiveRecord: 34.7ms)
This is what I get after it uploads:
And when pressing ADD it says "File is invalid"
And I'm not disallowing any file extensions under Administration > Settings > Files
Uploading an image file works fine however.
redmyne.PNG (9.86 KB) redmyne.PNG |
RE: Uploading a zip file under "files" in a project results in "invalid file" - Added by Bernhard Rohloff almost 6 years ago
On my development instance (latest trunk) it works just fine.
This is how the log looks like when uploading:
Started POST "/uploads.js?attachment_id=1&filename=blabla.zip&content_type=application%2Fzip" for 127.0.0.1 at 2019-02-13 09:54:18 +0100 Processing by AttachmentsController#upload as JS Parameters: {"attachment_id"=>"1", "filename"=>"blabla.zip", "content_type"=>"application/zip"} Token Update All (18.7ms) UPDATE "tokens" SET "updated_on" = '2019-02-13 09:54:18.933702' WHERE "tokens"."user_id" = ? AND "tokens"."value" = ? AND "tokens"."action" = ? [["user_id", 2], ["value", "318b203fd1db486ae8180194a56cf93f1f0d1df4"], ["action", "session"]] (0.2ms) SELECT MAX("settings"."updated_on") FROM "settings" User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."type" IN ('User', 'AnonymousUser') AND "users"."status" = ? AND "users"."id" = ? LIMIT ? [["status", 1], ["id", 2], ["LIMIT", 1]] Current user: jsmith (id=2) Role Load (0.5ms) SELECT DISTINCT "roles".* FROM "roles" INNER JOIN "member_roles" ON "member_roles"."role_id" = "roles"."id" INNER JOIN "members" ON "members"."id" = "member_roles"."member_id" INNER JOIN "projects" ON "projects"."id" = "members"."project_id" WHERE (projects.status <> 9) AND "members"."user_id" = 2 Role Load (0.2ms) SELECT "roles".* FROM "roles" WHERE "roles"."builtin" = ? LIMIT ? [["builtin", 1], ["LIMIT", 1]] (0.1ms) begin transaction Setting Load (0.4ms) SELECT "settings".* FROM "settings" WHERE "settings"."name" = ? ORDER BY "settings"."id" DESC LIMIT ? [["name", "attachment_extensions_denied"], ["LIMIT", 1]] Setting Load (0.1ms) SELECT "settings".* FROM "settings" WHERE "settings"."name" = ? ORDER BY "settings"."id" DESC LIMIT ? [["name", "attachment_extensions_allowed"], ["LIMIT", 1]] Saving attachment '/home/brohloff/tests/redmine/redmine-git/files/2019/02/190213095418_blabla.zip' (3287 bytes) Attachment Create (0.8ms) INSERT INTO "attachments" ("filename", "disk_filename", "filesize", "content_type", "digest", "author_id", "created_on", "disk_directory") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["filename", "blabla.zip"], ["disk_filename", "190213095418_blabla.zip"], ["filesize", 3287], ["content_type", "application/zip"], ["digest", "8b1ec75e7b8bb86422f86c31c63cc97f0b04e793547de26bb9dfa5cdd5c05e3f"], ["author_id", 2], ["created_on", "2019-02-13 09:54:18.970185"], ["disk_directory", "2019/02"]] (25.2ms) commit transaction (0.1ms) begin transaction Attachment Load (0.2ms) SELECT "attachments".* FROM "attachments" WHERE "attachments"."id" = ? LIMIT ? [["id", 21], ["LIMIT", 1]] Attachment Load (0.2ms) SELECT "attachments".* FROM "attachments" WHERE "attachments"."digest" = ? AND "attachments"."filesize" = ? AND (id <> 21 and disk_filename <> '190213095418_blabla.zip') ORDER BY "attachments"."id" ASC LIMIT ? [["digest", "8b1ec75e7b8bb86422f86c31c63cc97f0b04e793547de26bb9dfa5cdd5c05e3f"], ["filesize", 3287], ["LIMIT", 1]] (0.1ms) commit transaction Rendering attachments/upload.js.erb Rendered attachments/upload.js.erb (1.5ms) Completed 200 OK in 85ms (Views: 9.0ms | ActiveRecord: 48.2ms)
RE: Uploading a zip file under "files" in a project results in "invalid file" - Added by M WEI almost 6 years ago
Okay well, perhaps it has something to do with the size of the .zip file, I've set the max size to 20mb, the file in question was around 17mb.. when uploading a .zip file (i zipped up an image) it works fine.. I don't know what to do.
RE: Uploading a zip file under "files" in a project results in "invalid file" - Added by M WEI almost 6 years ago
OK
In my website's configuration in NGINX my client_max_body_size was set to 10m, I've increased it and now it works ;)