Skip to content

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Jul 25, 2022

  • Always respect the user's configured mime type map
  • Allow more types like image/pdf/video/audio to serve with correct content-type
  • Shorten cache duration of raw files to 5 minutes, matching GitHub
  • Don't set content-disposition: attachment, let the browser decide whether it wants to download or display a file directly
  • Implement rfc5987 for filenames, remove previous hack. Confirmed it working in Safari.
  • Make PDF attachment work in Safari by removing sandbox attribute.

This change will make a lot more file types open directly in browser now. Logic should generally be more readable than before with less if nesting and such.

Replaces: #20460
Replaces: #20455
Fixes: #20404

(continuation of #20464 which was destroyed)

@silverwind silverwind added type/enhancement An improvement of existing functionality backport/v1.17 labels Jul 25, 2022
@noerw

This comment was marked as resolved.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 26, 2022
- Always respect the user's configured mime type map
- Allow more types like image/pdf/video/audio to serve with correct content-type
- Shorten cache duration of raw files to 5 minutes, matching GitHub
- Don't set content-disposition: attachment, let the browser decide
- Implement rfc5987 for filenames, remove previous hack
@Gusted Gusted added this to the 1.18.0 milestone Jul 28, 2022
@GiteaBot GiteaBot removed the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 28, 2022
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jul 28, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 29, 2022
@6543 6543 merged commit eaf653f into go-gitea:main Jul 29, 2022
@6543
Copy link
Member

6543 commented Jul 29, 2022

@silverwind please backport

@6543 6543 added type/bug and removed type/enhancement An improvement of existing functionality labels Jul 29, 2022
@silverwind silverwind deleted the header-rework branch July 29, 2022 20:27
silverwind added a commit to silverwind/gitea that referenced this pull request Jul 29, 2022
- Always respect the user's configured mime type map
- Allow more types like image/pdf/video/audio to serve with correct content-type
- Shorten cache duration of raw files to 5 minutes, matching GitHub
- Don't set `content-disposition: attachment`, let the browser decide whether it wants to download or display a file directly
- Implement rfc5987 for filenames, remove previous hack. Confirmed it working in Safari.
- Make PDF attachment work in Safari by removing `sandbox` attribute.

This change will make a lot more file types open directly in browser now. Logic should generally be more readable than before with less `if` nesting and such.

Replaces: go-gitea#20460
Replaces: go-gitea#20455
Fixes: go-gitea#20404
@6543 6543 added the backport/done All backports for this PR have been created label Jul 30, 2022
6543 pushed a commit that referenced this pull request Jul 30, 2022
- Always respect the user's configured mime type map
- Allow more types like image/pdf/video/audio to serve with correct content-type
- Shorten cache duration of raw files to 5 minutes, matching GitHub
- Don't set `content-disposition: attachment`, let the browser decide whether it wants to download or display a file directly
- Implement rfc5987 for filenames, remove previous hack. Confirmed it working in Safari.
- Make PDF attachment work in Safari by removing `sandbox` attribute.

This change will make a lot more file types open directly in browser now. Logic should generally be more readable than before with less `if` nesting and such.

Replaces: #20460
Replaces: #20455
Fixes: #20404
zjjhot added a commit to zjjhot/gitea that referenced this pull request Aug 1, 2022
* giteaofficial/main: (29 commits)
  [skip ci] Updated translations via Crowdin
  Support localized README (go-gitea#20508)
  Clean up and fix clone button script (go-gitea#20415)
  Add disable download source configuration (go-gitea#20548)
  Fix default merge style (go-gitea#20564)
  Update login methods in package docs (go-gitea#20561)
  Add missing Tabs on organisation/package view (Frontport go-gitea#20539) (go-gitea#20540)
  [skip ci] Updated licenses and gitignores
  Add setting `SQLITE_JOURNAL_MODE` to enable WAL (go-gitea#20535)
  Rework file highlight rendering and fix yaml copy-paste (go-gitea#19967)
  Add new API endpoints for push mirrors management (go-gitea#19841)
  WebAuthn CredentialID field needs to be increased in size (go-gitea#20530)
  Add latest commit's SHA to content response (go-gitea#20398)
  Improve token and secret key generation docs (go-gitea#20387)
  [skip ci] Updated translations via Crowdin
  Rework raw file http header logic (go-gitea#20484)
  Update lunny/levelqueue to prevent NPE when reads are performed after close (go-gitea#20534)
  Added guidance on file to choose to download (go-gitea#20474)
  [skip ci] Updated translations via Crowdin
  Ensure that all unmerged files are merged when conflict checking (go-gitea#20528)
  ...
vsysoev pushed a commit to IntegraSDL/gitea that referenced this pull request Aug 10, 2022
- Always respect the user's configured mime type map
- Allow more types like image/pdf/video/audio to serve with correct content-type
- Shorten cache duration of raw files to 5 minutes, matching GitHub
- Don't set `content-disposition: attachment`, let the browser decide whether it wants to download or display a file directly
- Implement rfc5987 for filenames, remove previous hack. Confirmed it working in Safari.
- Make PDF attachment work in Safari by removing `sandbox` attribute.

This change will make a lot more file types open directly in browser now. Logic should generally be more readable than before with less `if` nesting and such.

Replaces: go-gitea#20460
Replaces: go-gitea#20455
Fixes: go-gitea#20404
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pdf inline viewer showing blocked plugin on issues attachment using safari
6 participants