Attachment ALLOWED_TYPE being ignored? #294

Closed
opened 2025-11-02 03:17:34 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @esell on GitHub (Jan 27, 2017).

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

Description

It appears that the ALLOWED_TYPE config attribute is not being honored. I looked inside of modules/setting/setting.go and it appears that this value is being hard coded, is that true?

AttachmentAllowedTypes = strings.Replace(sec.Key("ALLOWED_TYPES").MustString("image/jpeg,image/png,application/zip,application/gzip"), "|", ",", -1)

I'm not sure what that MustString function is (xorm related) but it appears that the MIME list is being fed in directly via the code and not the actual config attribute. Am I reading that wrong?
...

Originally created by @esell on GitHub (Jan 27, 2017). - Gitea version (or commit ref): e08421017c50d881710f52c9fd942239a4a928ae - Git version: 2.7.4 - Operating system: Ubuntu Linux (xenial) - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant - Log gist: ## Description It appears that the `ALLOWED_TYPE` config attribute is not being honored. I looked inside of `modules/setting/setting.go` and it appears that this value is being hard coded, is that true? AttachmentAllowedTypes = strings.Replace(sec.Key("ALLOWED_TYPES").MustString("image/jpeg,image/png,application/zip,application/gzip"), "|", ",", -1) I'm not sure what that `MustString` function is (xorm related) but it appears that the MIME list is being fed in directly via the code and not the actual config attribute. Am I reading that wrong? ...
GiteaMirror added the issue/not-a-bug label 2025-11-02 03:17:34 -06:00
Author
Owner

@esell commented on GitHub (Jan 27, 2017):

NM

@esell commented on GitHub (Jan 27, 2017): NM
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#294