Skip to content

No way to upload files with "text/plain; charset=utf-8" filetype #7882

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

Closed
2 of 7 tasks
dtluna opened this issue Aug 15, 2019 · 4 comments · Fixed by #7890
Closed
2 of 7 tasks

No way to upload files with "text/plain; charset=utf-8" filetype #7882

dtluna opened this issue Aug 15, 2019 · 4 comments · Fixed by #7890
Labels
Milestone

Comments

@dtluna
Copy link

dtluna commented Aug 15, 2019

  • Gitea version (or commit ref): Gitea version 1.9.1 built with GNU Make 4.2.1, go1.12.8 : bindata, sqlite, pam
  • Git version: git version 2.22.1
  • Operating system: Arch Linux ARM
  • 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:
Aug 15 18:40:17 dtluna.net gitea[21743]: 2019/08/15 18:40:17 ...s/repo/attachment.go:58:UploadAttachment() [I] Attachment with type text/plain; charset=utf-8 blocked from upload

Description

I have

ALLOWED_TYPES = "application/zip|application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|text/plain; charset=utf-8"

In my /etc/gitea/app.ini, but I still cannot upload checksums.txt at https://git.dtluna.net/dtluna/fallhack/releases/edit/v1.0.1

...

Screenshots

upload

@lunny
Copy link
Member

lunny commented Aug 16, 2019

There are two allowed_types, you may changed the wrong section. But of course, it's still a bug.

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

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

@dtluna
Copy link
Author

dtluna commented Aug 16, 2019

@lunny I am speaking specifically about the [attachment] section

@lunny
Copy link
Member

lunny commented Aug 16, 2019

For release, you should change repository.upload section not attachment

@dtluna
Copy link
Author

dtluna commented Aug 16, 2019

@lunny
I have this in my config

 [repository.upload]
 ;Whether repository file uploads are enabled. Defaults to `true`
 ENABLED = true
 ;Path for uploads. Defaults to `data/tmp/uploads` (tmp gets deleted on gitea restart)
 TEMP_PATH = data/tmp/uploads
 ; One or more allowed types, e.g. image/jpeg|image/png. Nothing means any file type
 ALLOWED_TYPES = "application/zip|application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|text/plain"

and I still cannot upload checksum.txt. But if I have this:

[attachment]
; Whether attachments are enabled. Defaults to `true`
ENABLED = true
; Path for attachments. Defaults to `data/attachments`
PATH = data/attachments
; One or more allowed types, e.g. image/jpeg|image/png
ALLOWED_TYPES = */*

then I can upload checksum.txt. I am positive that [attachment] is the section to configure.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants