go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
43.24k stars 5.32k forks source link

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

Open dangjinghao opened 3 months ago

dangjinghao commented 3 months ago

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:

in Minio url header.

There is a demo on my private site, http://64.112.41.7/test/test_lfs/

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

yp05327 commented 1 month ago

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