mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-16 13:20:06 -05:00
Cannot upload file of this type to a release (zip) #2764
Closed
opened 2025-11-02 04:47:27 -06:00 by GiteaMirror
·
30 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16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0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#2764
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ve3 on GitHub (Jan 17, 2019).
[x]):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.
@lunny commented on GitHub (Jan 17, 2019):
Have you restarted Gitea?
@ve3 commented on GitHub (Jan 17, 2019):
Yes, I did.
@justsomebody42 commented on GitHub (Jan 28, 2019):
I have the very same issue.
Any suggestions?
@uberhalit commented on GitHub (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-compressedtoALLOWED_TYPES@zeripath commented on GitHub (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-compressedeither that or we have to change dropzone upstream to have a list of mapping from old non valid mimetypes to real mimetypes.@ve3 commented on GitHub (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 commented on GitHub (Feb 1, 2019):
Are you running Gitea behind an nginx proxy? If so you will need to allow nginx to allow it too
@zeripath commented on GitHub (Feb 1, 2019):
Ok, here's where I think that's being set:
801843b011/public/vendor/plugins/dropzone/dropzone.js (L953)@zeripath commented on GitHub (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.
801843b011/public/vendor/plugins/dropzone/dropzone.js (L1583)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.
@stale[bot] commented on GitHub (Apr 2, 2019):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
@ve3 commented on GitHub (Apr 4, 2019):
I don't running nginx proxy. This problem even occur on https://try.gitea.io
As the link I provided https://try.gitea.io/ve3/test/src/tag/0.1
I'm not sure did you tried to upload .zip on your server ( https://try.gitea.io ) because it same and it is not just my browser problem.
@mrsdizzie commented on GitHub (Apr 4, 2019):
This worked fine for me on try.gitea.io just now:
https://try.gitea.io/mrsdizzie/parsing-errors/releases
That sshot.zip attachment has a mime-type of
application/zipsame as mentioned in the issue report.The link you've provided to try.gitea.io unfortunately doesn't help because of the nature of the problem (there is no file there for anybody to look at). Is it possible to share an example zip file that doesn't work right for you? Being able to reproduce will help track down what may be happening (can't reproduce it with my own application/zip file)
@ve3 commented on GitHub (Apr 4, 2019):
https://try.gitea.io/ve3/test/releases
Download (ZIP) from there
Edit release
Upload the zip file
Failed.
All the zip files cannot upload.
This seems to be only happens with Firefox on Windows (not sure Firefox on other os).
@mrsdizzie commented on GitHub (Apr 4, 2019):
I was just able to download that zip file, edit the release in my example, and the upload it fine:
https://try.gitea.io/mrsdizzie/parsing-errors/releases
It works on Safari, Chrome, and Firefox on macOS.
Can't reproduce with any of the current suggest steps here on my end unfortunately :( Sounds like perhaps a Firefox on Windows bug.
@mrsdizzie commented on GitHub (Apr 5, 2019):
Also FWIW some searching suggests this might be related to problems with the files Firefox uses to store mime-type information and starting over with a fresh profile seems to help many people having trouble uploading to different sites.
@efelon commented on GitHub (Apr 5, 2019):
gitea 1.7.5 armv7
on raspbian stretch
Browser chromium on Linux Mint
I wanted to add an observation, because I was curious if there is nothing in the logs about blocked mime-types, so one could just easily add them gitea kindly detected.
With this attaching zip files is possible on my installation. Then I did:
Modified app.ini: LEVEL = Trace && service gitea restartAfter restart I tried to upload a tar.gz file, and to my surprise in gitea.log I got:
2019/04/05 20:55:27 [I] Attachment with type application/x-gzip blocked from uploadEasy enough, went ahead and added that mime type + restart of gitea.
Uploading of tar.gz files still didn't work. So...long story short,
I never got a blocked entry in my logs after that again.
I restarted multiple times, reverted the ALLOWED_TYPES, changed ALLOWED_TYPES, changed LEVEL back and forth, logged in/out, changed user and multiple combinations of that. I never got a blocked entry in gitea.log again.
@dheadshot commented on GitHub (May 12, 2019):
I've just encountered this infuriating bug as a user of the showcase instance gitea.com - I created an account there to try and get away from this kind of nonsense on Github!
@ve3 commented on GitHub (May 28, 2019):
From try.gitea.io server, I tried to upload fake .jpg file.
I created fake .jpg file with .txt file. (new > text file > rename fake-image.jpg).
I try to select a file > success, the file was sent to server via XHR but the response is failed. Error 400 with message:
This issue stuck at select a file and then failed. It is not even upload yet.
My browser (Firefox on Windows) have no problem with normal upload HTML form with PHP, ASP.net, or any other programming languages on earth.
They can detect the real file's mime type correctly.
So, this problem should be fixed easily if we skip the check mime type part that is currently using JS and let it check with the server instead.
The server already do that (check mime type), doing this with JS is not necessary.
Edit:
This also happens with MS Edge. ( https://stackoverflow.com/q/32849014/128761 ). I'm not sure that Firefox, IE, and Edge use the same mime type data source but they both cant get JS input
files[0].type.Here is the source code to test get file's mime type from browser input.
Failed: IE, Firefox, Edge
@ashimokawa commented on GitHub (Jun 10, 2019):
I did exactly that change on https://codeberg.org and it works there now 🤷♂️
@ve3 commented on GitHub (Jun 10, 2019):
As I said, verify mime type using JS is based on browser and it is too much various causes (OS, browser, version on both OS & browser, etc).
Remove the JS mime type verification and let this task done by the server side to give it one standard.
@stale[bot] commented on GitHub (Aug 9, 2019):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
@JAD-SVK commented on GitHub (Aug 16, 2019):
I got today the same problem. I tried drag&drop and upload by clicking (file open dialogue).
My parameter are like this:
[x]):This setting helped for me:
TestZipFile.zip
File:
TestZipFile.txtContent:
This file is test file+ new line (CR+LF)Zipped using 7z version 19.00
@lunny commented on GitHub (Aug 16, 2019):
For release, you should change
repository.uploadsection notattachment@lunny commented on GitHub (Aug 16, 2019):
Please confirm @ve3 @JAD-SVK
@JAD-SVK commented on GitHub (Aug 16, 2019):
I need to add (configure)
To be able to upload zip files (from Vivaldi and Firefox on Windows 7) to release. Both types need to be active.
No configuration in
[repository.upload]make the upload in release work.@ve3 commented on GitHub (Aug 16, 2019):
@lunny Yes, but I must add both
[repository.upload]AND[attachment]the sameALLOWED_TYPESto make it work properly. Not just[repository.upload]OR[attachment]Full config example (about upload):
The configuration
[repository.upload]is not in anywhere in the document currently.( https://docs.gitea.io/en-us/config-cheat-sheet/ )
Problem seems to be resolved now.
However please consider my idea about file mime type verification only in one side (server side). To check mime type on client side (JS) can be a mess and duplicate task.
@memstone commented on GitHub (Sep 10, 2019):
This is work for me. thanks.
@DailytheNoob commented on GitHub (Feb 6, 2020):
I've followed the steps above (added to
repository.upload&attachment) but am still unable to upload a .zip with the same error message.@iamdoubz commented on GitHub (Sep 17, 2020):
So, I got the .zip to work, now I just need the .7z to work as well...
@sglux commented on GitHub (Nov 11, 2020):
regarding 7z, adding
application/x-7z-compresseddid not work for me.Above mime type is from mozilla.org - maybe it must be different?
Perheps a few usual file type should be in the default app.ini file!