Skip to content

fix: preserve content type when copying with headers - #709

Merged
ffumero2003 merged 3 commits into
masterfrom
fix-py-copy-content-type
Nov 21, 2026
Merged

ffumero2003 merged 3 commits into
masterfrom
fix-py-copy-content-type

Conversation

@ffumero2003

@ffumero2003 ffumero2003 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Context

Copying a file with HTTP header overrides and no explicit content type fails for ordinary copies, while a length-specified copy can lose the overrides.

Changes

  • Preserve the source content type and metadata when applying header overrides, using caller-supplied source metadata when available.
  • Omit an inherited whole-file SHA-1 from ranged copies, where it may not describe the copied bytes; retain an explicitly supplied destination checksum.
  • Document when source-info lookup requires readFiles and how supplied metadata avoids it.
  • Cover ordinary and multipart copies, source and destination metadata, SSE-C key identifiers, and denied metadata lookups. Convert the C1 expected failure into a regression test.

Verification

  • C1 reproducer failed with CopyArgumentsMismatch before the fix and passed afterward. The two-part ranged-copy checksum regression failed before the follow-up and passed afterward.
  • v2 bucket suites: 332 passed, 28 skipped, 4 xfailed; v3 bucket suites: 329 passed, 29 skipped, 6 xfailed. Both included 90 passing subtests.
  • v2 and v3 focused copy tests: 15 passed each after the documentation update.
  • nox -vs lint and nox -vs towncrier_check passed.
  • SDK review panel: PASS.

Refs #703

@ffumero2003 ffumero2003 self-assigned this Nov 21, 2026
@ffumero2003
ffumero2003 requested a review from goanpeca November 21, 2026 20:40
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

This organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c345d4ce-5c86-472b-bc9a-c01c79d5cbc0
Commits

Reviewing files that changed from the base of the PR and between 08f06b3 and 0be8e39.

Files selected for processing: 4

  • b2sdk/_internal/bucket.py
  • changelog.d/+copy-header-content-type.fixed.md
  • test/unit/bucket/test_copy_header_content_type.py
  • test/unit/bucket/test_regression_bucket.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@ffumero2003
ffumero2003 merged commit 747cab9 into master Nov 21, 2026
14 of 16 checks passed
@ffumero2003
ffumero2003 deleted the fix-py-copy-content-type branch November 21, 2026 20:58
ffumero2003 added a commit that referenced this pull request Nov 21, 2026
…#710)

PRs #708 and #709 both edited test/unit/bucket/test_regression_bucket.py;
the clean auto-merge left `defect_raises` imported but unused, failing
ruff (F401) on master. Drop the unused import.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant