Skip to content

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

@tcpluess

Description

@tcpluess

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions