Problem/Motivation

The links in the File column of the archive list (/admin/content/earkiv) do not download the archive. In Chrome the link opens a new tab instead.

The file entity of the archive is created without a MIME type, so filemime is empty in file_managed. The response for the private file then has no Content-Type header and no Content-Disposition header, and the browser has to guess what to do with a file of several gigabytes.

Steps to reproduce

  1. Create and store an archive.
  2. Go to /admin/content/earkiv and click the file name.
  3. Chrome opens a new tab instead of downloading the file. curl -I on the file URL shows no Content-Type.

Proposed resolution

  • Set the MIME type application/gzip when the file entity of the archive is created.
  • Add the download attribute to the link in the archive list, so the browser saves the file instead of opening it.
  • Add a post update function that sets the MIME type of the existing archive files.

Remaining tasks

  • Implement and test.
  • Review.

User interface changes

Clicking an archive in the list downloads it.

API changes

None.

Data model changes

None. A post update function sets filemime for existing archive files.

AI-Generated: Yes (Used Claude Code to find the cause and draft this issue.)

Issue fork earkiv-3636834

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

thomas alsén created an issue. See original summary.

  • thomas alsén committed 431da4ac on 1.0.x
    fix: #3636834 Archive links in the archive list open a new tab instead...
thomas alsén’s picture

Status: Active » Fixed

Merged into 1.0.x!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.