PPTX and other formats are badly recognized and downloaded with .zip extenstions #7301

Closed
opened 2025-11-02 07:22:27 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @dusatvoj on GitHub (May 6, 2021).

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

Description

Some people in our company have a problem when they upload pptx or docx or another OfficeOpenXML. It's downloaded with .zip extension bcs it's badly recognized. It's not happening in linux but in windows because it's zip mime type (some shitty windows stuff but it's annoying for them when they download presentation.pptx.zip). In linux is downloaded as pptx but with zip mime type (extension does not change)
I can understand why it's happening but I can't understand why mime type is not set by extension.

Screenshots

Originally created by @dusatvoj on GitHub (May 6, 2021). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.14.0 - Git version: 2.20.1 - Operating system: Debian 10 <!-- Please include information on whether you built gitea yourself, used one of our downloads or are using some other package --> <!-- Please also tell us how you are running gitea, e.g. if it is being run from docker, a command-line, systemd etc. ---> <!-- If you are using a package or systemd tell us what distribution you are using --> - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - Log gist: <!-- It really is important to provide pertinent logs --> <!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems --> <!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini --> ## Description <!-- If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services. --> Some people in our company have a problem when they upload `pptx` or `docx` or another OfficeOpenXML. It's downloaded with .zip extension bcs it's badly recognized. It's not happening in linux but in windows because it's `zip` mime type _(some shitty windows stuff but it's annoying for them when they download `presentation.pptx.zip`)_. In linux is downloaded as `pptx` but with zip mime type _(extension does not change)_ I can understand why it's happening but I can't understand why mime type is not set by extension. ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/bug label 2025-11-02 07:22:27 -06:00
Author
Owner

@sapk commented on GitHub (May 9, 2021):

We use go standard lib mime.TypeByExtension in Gitea to determine mime types on server side.
It is based on the host configuration: https://golang.org/src/mime/type.go?s=2843:2882#L91

Maybe you can add those mime types to the host list (and restart gitea after )?

On our side we could maybe add some extra not available on most OS distribution ?

@sapk commented on GitHub (May 9, 2021): We use go standard lib [mime.TypeByExtension](https://github.com/go-gitea/gitea/blob/ab77a24f18ae45248bd6c71778fe3bfacacf864f/modules/public/static.go#L69) in Gitea to determine mime types on server side. It is based on the host configuration: https://golang.org/src/mime/type.go?s=2843:2882#L91 Maybe you can add those mime types to the host list (and restart gitea after )? On our side we could maybe add some extra not available on most OS distribution ?
Author
Owner

@dusatvoj commented on GitHub (May 9, 2021):

I have Debian 10 on server and mime.types has extension pptx defined as below.

application/vnd.openxmlformats-officedocument.presentationml.presentation       pptx

But pptx is downloaded as zip mime type (screenshot below) ...
Screenshot

Tested in latest firefox on linux

@dusatvoj commented on GitHub (May 9, 2021): I have Debian 10 on server and `mime.types` has extension `pptx` defined as below. ``` application/vnd.openxmlformats-officedocument.presentationml.presentation pptx ``` But `pptx` is downloaded as zip mime type (screenshot below) ... ![Screenshot](https://user-images.githubusercontent.com/11560794/117586688-010fa280-b11a-11eb-898b-c563956e6330.png) Tested in latest firefox on linux
Author
Owner

@zeripath commented on GitHub (May 10, 2021):

This can now be solved with #15133

@zeripath commented on GitHub (May 10, 2021): This can now be solved with #15133
Author
Owner

@techknowlogick commented on GitHub (May 10, 2021):

Closing per linked PR

@techknowlogick commented on GitHub (May 10, 2021): Closing per linked PR
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7301