Cannot upload jar file #3497

Closed
opened 2025-11-02 05:14:54 -06:00 by GiteaMirror · 19 comments
Owner

Originally created by @tomposmiko on GitHub (Jun 20, 2019).

  • Gitea version (or commit ref): 1.8.3
  • Operating system: Ubuntu 18.04
  • Database (use [x]):
    • PostgreSQL
    • [ x] MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Despite this setting:
ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive

I does not allow upload jar files.
If I set /, then the upload is allowed.

application/* also does not allow me to do that.

What should be the appropriate setting?
...

Screenshots

Originally created by @tomposmiko on GitHub (Jun 20, 2019). - Gitea version (or commit ref): 1.8.3 - Operating system: Ubuntu 18.04 - Database (use `[x]`): - [ ] PostgreSQL - [ x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description Despite this setting: ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive I does not allow upload jar files. If I set */*, then the upload is allowed. application/* also does not allow me to do that. What should be the appropriate setting? ... ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/questionissue/confirmed labels 2025-11-02 05:14:54 -06:00
Author
Owner

@PedroAS7 commented on GitHub (Aug 8, 2019):

application/java-archive not working on Gitea 1.9.0 either

@PedroAS7 commented on GitHub (Aug 8, 2019): _application/java-archive_ not working on Gitea 1.9.0 either
Author
Owner

@tomposmiko commented on GitHub (Aug 16, 2019):

What is the severity of this issue from your perspective?

@tomposmiko commented on GitHub (Aug 16, 2019): What is the severity of this issue from your perspective?
Author
Owner

@lunny commented on GitHub (Aug 16, 2019):

Where did you upload? Releases or issues?

@lunny commented on GitHub (Aug 16, 2019): Where did you upload? Releases or issues?
Author
Owner

@lunny commented on GitHub (Aug 16, 2019):

There are two allowed_types, you may changed the wrong section. I uploaded successfully on my local instance both the releases and issues.

[repository.upload]
ALLOWED_TYPES = "application/zip|application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|application/java-archive"

[attachment]
ALLOWED_TYPES = "application/zip|application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|application/java-archive"

@lunny commented on GitHub (Aug 16, 2019): There are two allowed_types, you may changed the wrong section. I uploaded successfully on my local instance both the releases and issues. ```ini [repository.upload] ALLOWED_TYPES = "application/zip|application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|application/java-archive" [attachment] ALLOWED_TYPES = "application/zip|application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|application/java-archive" ```
Author
Owner

@tomposmiko commented on GitHub (Aug 16, 2019):

Where did you upload? Releases or issues?

releases

@tomposmiko commented on GitHub (Aug 16, 2019): > Where did you upload? Releases or issues? releases
Author
Owner

@tomposmiko commented on GitHub (Aug 23, 2019):

Hmm, this is interesting.

$ mkdir -p data/tmp/uploads
$ chown ...
$ service gitea restart

And it starts working.
However, after second restart, it stops working, because the tmp directory is gone!
In fact I investigated the following scenarios:

  1. no [repsitory.upload] section in app.ini
    -> no success, even if the directory is created.

[repository.upload]
ENABLED = true
TEMP_PATH = data/tmp/uploads
FILE_MAX_SIZE = 3
MAX_FILES = 5
ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive

It works after first service restart if the directory is created. It does not work after the second restart, the tmp directory is gone.

  1. [repository.upload]
    ENABLED = true
    TEMP_PATH = /data/gitea/data/tmp/uploads
    FILE_MAX_SIZE = 3
    MAX_FILES = 5
    ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive

Directory created, service restarted.
No success

  1. TEMP_PATH = tmp/uploads
    Directory created, service restarted.
    No success

So I got lost, I have no idea

@tomposmiko commented on GitHub (Aug 23, 2019): Hmm, this is interesting. $ mkdir -p data/tmp/uploads $ chown ... $ service gitea restart And it starts working. However, after second restart, it stops working, because the tmp directory is gone! In fact I investigated the following scenarios: 1. no [repsitory.upload] section in app.ini -> no success, even if the directory is created. 2. [repository.upload] ENABLED = true TEMP_PATH = data/tmp/uploads FILE_MAX_SIZE = 3 MAX_FILES = 5 ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive It works after first service restart if the directory is created. It does not work after the second restart, the tmp directory is gone. 3. [repository.upload] ENABLED = true TEMP_PATH = /data/gitea/data/tmp/uploads FILE_MAX_SIZE = 3 MAX_FILES = 5 ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive Directory created, service restarted. No success 4. TEMP_PATH = tmp/uploads Directory created, service restarted. No success So I got lost, I have no idea
Author
Owner

@lafriks commented on GitHub (Aug 24, 2019):

You should try mount tmp as volume in docker

@lafriks commented on GitHub (Aug 24, 2019): You should try mount tmp as volume in docker
Author
Owner

@tomposmiko commented on GitHub (Aug 24, 2019):

I don't use docker.

@tomposmiko commented on GitHub (Aug 24, 2019): I don't use docker.
Author
Owner

@tomposmiko commented on GitHub (Aug 27, 2019):

Hmm, this is interesting.

$ mkdir -p data/tmp/uploads
$ chown ...
$ service gitea restart

And it starts working.
However, after second restart, it stops working, because the tmp directory is gone!
In fact I investigated the following scenarios:

  1. no [repsitory.upload] section in app.ini
    -> no success, even if the directory is created.

[repository.upload]
ENABLED = true
TEMP_PATH = data/tmp/uploads
FILE_MAX_SIZE = 3
MAX_FILES = 5
ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive

It works after first service restart if the directory is created. It does not work after the second restart, the tmp directory is gone.

  1. [repository.upload]
    ENABLED = true
    TEMP_PATH = /data/gitea/data/tmp/uploads
    FILE_MAX_SIZE = 3
    MAX_FILES = 5
    ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive

Directory created, service restarted.
No success

  1. TEMP_PATH = tmp/uploads
    Directory created, service restarted.
    No success

So I got lost, I have no idea

@tomposmiko commented on GitHub (Aug 27, 2019): Hmm, this is interesting. $ mkdir -p data/tmp/uploads $ chown ... $ service gitea restart And it starts working. However, after second restart, it stops working, because the tmp directory is gone! In fact I investigated the following scenarios: 1. no [repsitory.upload] section in app.ini -> no success, even if the directory is created. 2. [repository.upload] ENABLED = true TEMP_PATH = data/tmp/uploads FILE_MAX_SIZE = 3 MAX_FILES = 5 ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive It works after first service restart if the directory is created. It does not work after the second restart, the tmp directory is gone. 3. [repository.upload] ENABLED = true TEMP_PATH = /data/gitea/data/tmp/uploads FILE_MAX_SIZE = 3 MAX_FILES = 5 ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/java-archive Directory created, service restarted. No success 4. TEMP_PATH = tmp/uploads Directory created, service restarted. No success So I got lost, I have no idea
Author
Owner

@tomposmiko commented on GitHub (Aug 27, 2019):

Is it a bug or do I miss something?

@tomposmiko commented on GitHub (Aug 27, 2019): Is it a bug or do I miss something?
Author
Owner

@sapk commented on GitHub (Aug 28, 2019):

Gitea should support upload of java archive so it must be a configuration or system problem.
To be able to debug, do you have any log of the failed upload ?

@sapk commented on GitHub (Aug 28, 2019): Gitea should support upload of java archive so it must be a configuration or system problem. To be able to debug, do you have any log of the failed upload ?
Author
Owner

@stale[bot] commented on GitHub (Oct 27, 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.

@stale[bot] commented on GitHub (Oct 27, 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.
Author
Owner

@reikjarloekl commented on GitHub (Jan 14, 2020):

I have the same issue but with .zip files. Can be reproduced on try.giteo.io using a Windows 10 PC and Chrome or Firefox.
It works using iOS! So apparently, mime type is set differently/ incorrectly using Windows 10/ Chrome or Firefox?

2020-01-14 21_09_59-Release aktualisieren - test - Gitea_ Git with a cup of tea - https___try gitea
@reikjarloekl commented on GitHub (Jan 14, 2020): I have the same issue but with .zip files. Can be reproduced on try.giteo.io using a Windows 10 PC and Chrome or Firefox. It works using iOS! So apparently, mime type is set differently/ incorrectly using Windows 10/ Chrome or Firefox? <img width="398" alt="2020-01-14 21_09_59-Release aktualisieren - test - Gitea_ Git with a cup of tea - https___try gitea" src="https://user-images.githubusercontent.com/839540/72378750-500a1b00-3712-11ea-963e-4505d245a26e.png">
Author
Owner

@sapk commented on GitHub (Jan 14, 2020):

Yes, It is possible that browser/os use different value. You can debug the mime type in gitea log or with the network inspector on firefox and chrome.
For Chrome: https://developers.google.com/web/tools/chrome-devtools/network#load

@sapk commented on GitHub (Jan 14, 2020): Yes, It is possible that browser/os use different value. You can debug the mime type in gitea log or with the network inspector on firefox and chrome. For Chrome: https://developers.google.com/web/tools/chrome-devtools/network#load
Author
Owner

@reikjarloekl commented on GitHub (Jan 14, 2020):

There is no activity in the network tab. Possibly the javascript is already blocking the file from being uploaded?

@reikjarloekl commented on GitHub (Jan 14, 2020): There is no activity in the network tab. Possibly the javascript is already blocking the file from being uploaded?
Author
Owner

@sapk commented on GitHub (Jan 14, 2020):

You need to open the network tab before uploading the file

@sapk commented on GitHub (Jan 14, 2020): You need to open the network tab before uploading the file
Author
Owner

@reikjarloekl commented on GitHub (Jan 14, 2020):

I did...

gitea-upload-invalid-type

@reikjarloekl commented on GitHub (Jan 14, 2020): I did... ![gitea-upload-invalid-type](https://user-images.githubusercontent.com/839540/72388012-2ad2d800-3725-11ea-976b-e61afc31a01f.gif)
Author
Owner

@zeripath commented on GitHub (Jan 15, 2020):

It'll be dropzone.js that is blocking the zip directly.

@zeripath commented on GitHub (Jan 15, 2020): It'll be dropzone.js that is blocking the zip directly.
Author
Owner

@dochan-consultis commented on GitHub (Jan 30, 2020):

I have also same issue with zip files. It is because of mime-types from code of dropzone.js. Allowed are these image/jpeg,image/png,application/zip,application/gzip and from Win10 with chrome when uploading zip is application/x-zip-compressed.

@dochan-consultis commented on GitHub (Jan 30, 2020): I have also same issue with zip files. It is because of mime-types from code of dropzone.js. Allowed are these `image/jpeg,image/png,application/zip,application/gzip` and from Win10 with chrome when uploading zip is `application/x-zip-compressed`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3497