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

Cannot upload file of this type to a release (zip) #5750

Open
ve3 opened this Issue Jan 17, 2019 · 9 comments

Comments

5 participants
@ve3
Copy link
Contributor

ve3 commented Jan 17, 2019

Description

I tried to upload a file to a release but got error message "You cannot upload files of this type".
The file is zip and its mime type is application/zip.

Here is app.ini configuration.

[attachment]
ENABLED = true
PATH = D:/my-work-spaces/gitea/data/attachments
ALLOWED_TYPES = application/zip|application/x-compressed-tar|application/x-gzip
MAX_SIZE = 20
MAX_FILES = 1
@lunny

This comment has been minimized.

Copy link
Member

lunny commented Jan 17, 2019

Have you restarted Gitea?

@ve3

This comment has been minimized.

Copy link
Contributor Author

ve3 commented Jan 17, 2019

Have you restarted Gitea?

Yes, I did.

@justsomebody42

This comment has been minimized.

Copy link

justsomebody42 commented Jan 28, 2019

I have the very same issue.
Any suggestions?

@uberhalit

This comment has been minimized.

Copy link

uberhalit commented Jan 31, 2019

Same here on latest 1.7.1, it won't let me upload zip files even though they are explicitly allowed.

Workaround: add application/x-zip-compressed to ALLOWED_TYPES

@zeripath

This comment has been minimized.

Copy link
Contributor

zeripath commented Feb 1, 2019

Hmm ok so if the data gets to Gitea it will definitely be assigned a mimetype of application/zip.

This mimetype is being assigned by your browser and is being checked in dropzone. Are you using internet explorer?

Unfortunately there's not much that can be done - I think you just have to add application/x-zip-compressed either that or we have to change dropzone upstream to have a list of mapping from old non valid mimetypes to real mimetypes.

@ve3

This comment has been minimized.

Copy link
Contributor Author

ve3 commented Feb 1, 2019

I'm using Firefox.
Added application/zip|application/x-zip|application/x-zip-compressed|application/x-compress|application/x-compressed|multipart/x-zip (copied from https://filext.com/file-extension/ZIP ) but still does not work.

Of cause, I'm already restarted Gitea.

Gitea 1.7.0

@zeripath

This comment has been minimized.

Copy link
Contributor

zeripath commented Feb 1, 2019

Are you running Gitea behind an nginx proxy? If so you will need to allow nginx to allow it too

@zeripath

This comment has been minimized.

Copy link
Contributor

zeripath commented Feb 1, 2019

Ok, here's where I think that's being set:

} else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {

@zeripath

This comment has been minimized.

Copy link
Contributor

zeripath commented Feb 1, 2019

If you're not running an nginx proxy then I think this is something to do with your browser - I am really not sure that this is even getting to the Gitea server and I think your upload is being rejected by dropzone.

Dropzone.isValidFile = function(file, acceptedFiles) {

This is on your browser so you should be able to double check what it's seeing by sticking breakpoints in in the developer console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment