Skip to content

Conversation

PLPeeters
Copy link
Contributor

@PLPeeters PLPeeters commented Jun 25, 2025

What do these changes do?

They make it so empty parts are ignored when parsing the Content-Disposition header to avoid trivial parsing issues.

Are there changes in behavior for the user?

Trivially correctible Content-Disposition headers will now be parsed instead of logging a warning and returning None.

Is it a substantial burden for the maintainers to support this?

No.

Related issue number

Fixes #5988

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES/ folder
    • name it <issue_or_pr_num>.<type>.rst (e.g. 588.bugfix.rst)

    • if you don't have an issue number, change it to the pull request
      number after creating the PR

      • .bugfix: A bug fix for something the maintainers deemed an
        improper undesired behavior that got corrected to match
        pre-agreed expectations.
      • .feature: A new behavior, public APIs. That sort of stuff.
      • .deprecation: A declaration of future API removals and breaking
        changes in behavior.
      • .breaking: When something public is removed in a breaking way.
        Could be deprecated in an earlier release.
      • .doc: Notable updates to the documentation structure or build
        process.
      • .packaging: Notes for downstreams about unobvious side effects
        and tooling. Changes in the test invocation considerations and
        runtime assumptions.
      • .contrib: Stuff that affects the contributor experience. e.g.
        Running tests, building the docs, setting up the development
        environment.
      • .misc: Changes that are hard to assign to any of the above
        categories.
    • Make sure to use full sentences with correct case and punctuation,
      for example:

      Fixed issue with non-ascii contents in doctest text files
      -- by :user:`contributor-gh-handle`.

      Use the past tense or the present tense a non-imperative mood,
      referring to what's changed compared to the last released version
      of this project.

@PLPeeters PLPeeters requested a review from asvetlov as a code owner June 25, 2025 14:53
@PLPeeters PLPeeters force-pushed the content-disposition-parsing-improvement branch from fe116a2 to b62024e Compare June 25, 2025 14:57
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Jun 25, 2025
Copy link

codspeed-hq bot commented Jun 25, 2025

CodSpeed Performance Report

Merging #11243 will not alter performance

Comparing PLPeeters:content-disposition-parsing-improvement (b62024e) with master (a5aa198)

Summary

✅ 59 untouched benchmarks

@Dreamsorcerer Dreamsorcerer added the backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot label Jun 26, 2025
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.84%. Comparing base (2dcf534) to head (b62024e).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11243      +/-   ##
==========================================
- Coverage   98.84%   98.84%   -0.01%     
==========================================
  Files         131      131              
  Lines       43280    43293      +13     
  Branches     2328     2329       +1     
==========================================
+ Hits        42782    42792      +10     
- Misses        343      346       +3     
  Partials      155      155              
Flag Coverage Δ
CI-GHA 98.73% <100.00%> (-0.01%) ⬇️
OS-Linux 98.46% <100.00%> (-0.01%) ⬇️
OS-Windows 96.80% <100.00%> (-0.01%) ⬇️
OS-macOS 97.68% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 97.07% <100.00%> (-0.27%) ⬇️
Py-3.10.18 97.82% <100.00%> (-0.01%) ⬇️
Py-3.11.13 97.41% <100.00%> (-0.60%) ⬇️
Py-3.11.9 97.53% <100.00%> (-0.01%) ⬇️
Py-3.12.10 97.62% <100.00%> (+<0.01%) ⬆️
Py-3.12.11 97.52% <100.00%> (-0.59%) ⬇️
Py-3.13.3 97.77% <100.00%> (-0.60%) ⬇️
Py-3.9.13 97.21% <100.00%> (-0.01%) ⬇️
Py-3.9.23 97.11% <100.00%> (-0.59%) ⬇️
Py-pypy7.3.16 89.01% <100.00%> (-5.65%) ⬇️
VM-macos 97.68% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 98.46% <100.00%> (-0.01%) ⬇️
VM-windows 96.80% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@Dreamsorcerer Dreamsorcerer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks reasonable.

@Dreamsorcerer Dreamsorcerer merged commit f01cb5e into aio-libs:master Jun 28, 2025
40 of 42 checks passed
Copy link
Contributor

patchback bot commented Jun 28, 2025

Backport to 3.13: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.13/f01cb5e16147a38f20ff16932c2c6bb8ea5c783c/pr-11243

Backported as #11248

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jun 28, 2025
Dreamsorcerer pushed a commit that referenced this pull request Jun 28, 2025
…ontent-Disposition header (#11248)

**This is a backport of PR #11243 as merged into master
(f01cb5e).**

Co-authored-by: Pierre-Louis Peeters <[email protected]>
@PLPeeters
Copy link
Contributor Author

@Dreamsorcerer Any reason for not backporting to 3.12? Awesome to have a backport bot now, by the way 😁

@Dreamsorcerer
Copy link
Member

Dreamsorcerer commented Jun 29, 2025

Any reason for not backporting to 3.12?

Feels like a new feature to me, so not sure it makes sense to go to 3.12. I'm thinking we'll probably release 3.13 alongside Python 3.14 anyway.

Awesome to have a backport bot now, by the way

We have for many years, it just hits conflicts with most PRs due to how far master has diverged. Got lucky on this one.

@PLPeeters
Copy link
Contributor Author

Feels like a new feature to me, so not sure it makes sense to go to 3.12. I'm thinking we'll probably release 3.13 alongside Python 3.14 anyway.

From my point of view, it looks more like an improvement than a new feature since it didn't add anything.

Your call of course, but I'd have immediate use for it being in 3.12; would be nice to avoid manual parsing.

@PLPeeters PLPeeters deleted the content-disposition-parsing-improvement branch June 30, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gracefully handle non-conforming Content-Disposition headers
2 participants