Attachment file type is not allowed #3517

Closed
opened 2025-11-02 05:15:38 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @pditommaso on GitHub (Jun 26, 2019).

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

Description

I've the following config for the attachments

[attachment]
ENABLED       = true
PATH          = /var/lib/gitea/data/attachments/
MAX_SIZE      = 4
MAX_FILES     = 5
ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip

However, when uploading a zip file it says "File type is not allowed".

Screenshots

Screenshot 2019-06-26 at 16 56 10
Originally created by @pditommaso on GitHub (Jun 26, 2019). - Gitea version (or commit ref): 1.8.1 - Git version: 2.7.4 - Operating system: Linux - 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 I've the following config for the attachments ``` [attachment] ENABLED = true PATH = /var/lib/gitea/data/attachments/ MAX_SIZE = 4 MAX_FILES = 5 ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip ``` However, when uploading a zip file it says "File type is not allowed". ## Screenshots <img width="854" alt="Screenshot 2019-06-26 at 16 56 10" src="https://user-images.githubusercontent.com/816968/60190710-65316200-9833-11e9-8a35-6e2bac366fb2.png">
GiteaMirror added the type/questionissue/stale labels 2025-11-02 05:15:38 -06:00
Author
Owner

@vorlif commented on GitHub (Jun 26, 2019):

Hi pditommaso,

please try to add:

  • application/octet-stream,
  • application/x-zip-compressed
  • multipart/x-zip
@vorlif commented on GitHub (Jun 26, 2019): Hi pditommaso, please try to add: * application/octet-stream, * application/x-zip-compressed * multipart/x-zip
Author
Owner

@pditommaso commented on GitHub (Jun 27, 2019):

Tried this, still no joy:

ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/octet-stream|application/x-zip-compressed|multipart/x-zip
@pditommaso commented on GitHub (Jun 27, 2019): Tried this, still no joy: ``` ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/octet-stream|application/x-zip-compressed|multipart/x-zip ```
Author
Owner

@silverwind commented on GitHub (Jun 29, 2019):

File input allows specifying types by extension too, try adding the .zip extension directly:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept

@silverwind commented on GitHub (Jun 29, 2019): File input allows specifying types by extension too, try adding the `.zip` extension directly: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept
Author
Owner

@silverwind commented on GitHub (Jun 29, 2019):

If above does not work, we can probably add support by it by passing the value of attachment.ALLOWED_TYPES directly to the <input>, replacing | with , in process.

@silverwind commented on GitHub (Jun 29, 2019): If above does not work, we can probably add support by it by passing the value of `attachment.ALLOWED_TYPES` directly to the `<input>`, replacing `|` with `,` in process.
Author
Owner

@stale[bot] commented on GitHub (Aug 28, 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 (Aug 28, 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

@stale[bot] commented on GitHub (Sep 11, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Sep 11, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3517