-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Initial chars in readme misinterpreted as audio file #17108
Comments
it's |
Yep, |
Seems like a bug in |
To be honest, I do not treat it as a bug. Because the mime auto-detectors just work as this behavior. You can not always correctly guess a file type by its content or extension name (eg: nginx, https://github.com/nginx/nginx/blob/master/conf/mime.types ) |
The problem is: As remediation, try to prepend a I think that this issue can then be closed here because even if it is surprisingly a bug and not intended, there is nothing Gitea can or should do here. |
Will be fixed by: Fix ID3 content detection #23355 |
Close #17108 This PR uses a trick (removing the ID3 tag) to detect the content again to to see whether the content is text type. --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Close go-gitea#17108 This PR uses a trick (removing the ID3 tag) to detect the content again to to see whether the content is text type. --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Close go-gitea#17108 This PR uses a trick (removing the ID3 tag) to detect the content again to to see whether the content is text type. --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Backport #23355 Close #17108 This PR uses a trick (removing the ID3 tag) to detect the content again to to see whether the content is text type. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Gitea Version
1.15.2 built with GNU Make 4.1, go1.16.7
Git Version
not relevant
Operating System
Debian 10/x64
How are you running Gitea?
apt install / locally
Database
SQLite
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Description
When uploading a readme.md file starting with ID3 the file is mistaken for an MP3 audio file. Example content
(MP3 files may start with ID3 tag but shouldn't be used to identify such files to begin with, but that's another issue :) )
So my README.md files shows up as raw file:
and clicking on the file line itself shows me the audio player:
The content of the readme file is correct, verified and is just text (the example above is a direct copy from it). :)
Screenshots
Network activity snapshot
Adding a new-line at the top of the file acts as a workaround and Gitea accepts the file properly as text/md file:
The text was updated successfully, but these errors were encountered: