When saving an LFS PDF file on Minio, the PDF preview may fail when SERVE_DIRECT is set to true. #12843

Closed
opened 2025-11-02 10:22:38 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @dangjinghao on GitHub (Apr 15, 2024).

Description

i configured the [storage] section of configuration so that save most huge file on Minio (Cloudflare R2).
(set SERVE_DIRECT = true)

I have a repository that tracing a .pdf file as LFS. After I pushed this repository and previewed this pdf file on gitea website. the browser simply downloaded the PDF without providing an inline preview.

Then I created a demo that test the performance of pdfobj (the previewer gitea used) on Minio.I found That:

  • The Content-Disposition must set to inline
  • Content-type should be application/pdf

in Minio url header.

There is a demo on my private site, <removed>

I’ve addressed this issue in my fork, but the fix involved numerous code changes to implement my solution. I’m uncertain whether this approach is optimal.

Gitea Version

1.23.0+dev-129-gef3941f2e and 1.21.10

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker-compose and gitea:nightly or gitea:latest

Database

SQLite

Originally created by @dangjinghao on GitHub (Apr 15, 2024). ### Description i configured the [storage] section of configuration so that save most huge file on Minio (Cloudflare R2). (set SERVE_DIRECT = true) I have a repository that tracing a .pdf file as LFS. After I pushed this repository and previewed this pdf file on gitea website. the browser simply downloaded the PDF without providing an inline preview. Then I created a demo that test the performance of pdfobj (the previewer gitea used) on Minio.I found That: - The `Content-Disposition` must set to `inline` - `Content-type` should be `application/pdf` in Minio url header. There is a demo on my private site, `<removed>` [I’ve addressed this issue in my fork](https://github.com/dangjinghao/gitea/commit/b52488b263306f56b68a807615cb0d96a289bbbe), but the fix involved numerous code changes to implement my solution. I’m uncertain whether this approach is optimal. ### Gitea Version 1.23.0+dev-129-gef3941f2e and 1.21.10 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? docker-compose and gitea:nightly or gitea:latest ### Database SQLite
GiteaMirror added the topic/lfstype/bug labels 2025-11-02 10:22:38 -06:00
Author
Owner

@yp05327 commented on GitHub (Jun 4, 2024):

Can you send a PR, then we can review it.

@yp05327 commented on GitHub (Jun 4, 2024): Can you send a PR, then we can review it.
Author
Owner

@dangjinghao commented on GitHub (Feb 18, 2025):

Apologies for my long period of non-response, previously this bug was relatively rare and in the process of trying to fix it on my branch I realized: too many components in gitea server need to be modified. So I didn't think it was worth fixing and left it until now. Now I think this issue should be closed.

@dangjinghao commented on GitHub (Feb 18, 2025): Apologies for my long period of non-response, previously **this bug was relatively rare** and in the process of trying to fix it on my branch I realized: too many components in gitea server need to be modified. So I didn't think it was worth fixing and left it until now. Now I think this issue should be closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12843