IQSS / IQSS/dataverse

Inconsistency in Content-Disposition format

Open
#7,962 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature: API Type: Bug User Role: API User
Dominant language
Java
Stars
1.1k
Forks
564
Avg merge
2d 2h
Merged PRs (30d)
29

Description

Dataverse returns Content-Disposition header for a file in two different formats depending on where the file is physically stored. E.g.:

import requests

url = "https://dataverse.harvard.edu/api/access/datafile/3315157"
req = requests.get(url, allow_redirects=True)
print(f"File (id:3315157) - tab version not on S3: {req.headers['Content-Disposition']}")
req = requests.get(url + "?format=original", allow_redirects=True)
print(f"File (id:3315157) - original version on S3: {req.headers['Content-Disposition']}")

yields:

File (id:3315157) - tab version not on S3: attachment; filename="Karnataka_DD%26FS_Data-1.tab"
File (id:3315157) - original version on S3: attachment; filename*=UTF-8''Karnataka_DD%26FS_Data-1.xlsx

Note that in both cases filename has escaped and encoded characters per RFC 5987. However, only the latter format of the header is the correct ("filename*" indicates that name is encoded, see e.g. Content-Disposition def)
Related PRs: #4542 and #7503

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two responses with the Python requests example and compare the Content-Disposition headers for the default and original formats. Trace the API response handling for files stored in different locations, then verify that both paths use the RFC 5987 filename* form consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.