Skip to content
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

When viewing a PDF file in a repository via browser, it appears to be cached and cannot be downloaded properly. #15518

Closed
2 of 6 tasks
tcpluess opened this issue Apr 16, 2021 · 3 comments

Comments

@tcpluess
Copy link

tcpluess commented Apr 16, 2021

Description

Steps to reproduce:

  1. add the first PDF file from the attachments to a repository, and name the file e.g. test.pdf.
  2. commit & push.
  3. in the web UI, navigate to the repository and display the PDF file in the repository. The PDF is nicely displayed.
  4. simulate some changes in the PDF by replacing the existing PDF with the second ond from the attachment. Git marks the PDF file as changed, because there are differences.
  5. commit & push.
  6. in the web UI, navigate to the repository and display the PDF. Expected behaviour: the replaced PDF should be shown (with the changes). Actual behaviour: the browser still loads the old version of the PDF, without the changes.
  7. in the web UI, navigate to the PDF, and select the Raw download. The browser downloads the wrong PDF file with the old contents.
  8. in the web UI, choose "Download Repository". In the downloaded ZIP or TAR file, the correct PDF is included.

Obviously, Gitea (or the web browser) performs some internal caching which leads to the fact that PDF files are not properly updated when they have been changed. Even refreshing the page in the browser does not solve the issue. It can only resolved by using a browser on a different computer, using an "incognito" tab or completely clearing the browser cache. While it is not strictly necessary to have PDF files in Git, it still indicates some problems with caching and the question arises: could this behaviour also affect other files, e.g. plain text files, or source code files or images?

test.pdf
test.pdf

@KN4CK3R
Copy link
Member

KN4CK3R commented Apr 19, 2021

That should be fixed with #15370.

@dfujim
Copy link

dfujim commented Mar 21, 2022

I have this same issue with firefox but not chrome. If I navigate to view the file via the exact commit, then the pdf renders properly, if not then I see the "cached" version.

Mozilla Firefox 98.0.1
Google Chrome 99.0.4844.82
git version 2.25.1
os CentOS Linux 7
gitea version 1.16.2
database SQLite3

For some reason this does not reproduce in the example above, but when I produce my own version the cached issue persists.

Version 1
Version 2

File link, should show version 2, but shows version 1.

PDFs produced with latex, if that makes a difference

@wxiaoguang
Copy link
Contributor

That should be fixed with #15370.

Close this one.

@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
None yet
Projects
None yet
Development

No branches or pull requests

4 participants