Repository navigation
feat(pyamber): require bucket and key in large binary URIs - #9626
Draft
Matthew-DWM wants to merge 1 commit into
Draft
Matthew-DWM wants to merge 1 commit into
Matthew-DWM wants to merge 1 commit into
Conversation
largebinary.__init__ only checked the "s3://" prefix, so URIs such as s3://, s3:///object, s3://bucket and s3://bucket/ constructed fine and then reached S3 with an empty bucket or object key. The constructor now parses the URI with urlparse, as get_bucket_name() and get_object_key() already do, and raises ValueError naming the URI when either part is empty, so every accepted URI yields a non-empty bucket and key. The no-argument constructor goes through the same check, so a misconfigured large-binaries base URI (for example "s3://") now fails when the largebinary is created instead of at upload time. Builds on the urlparse approach from apache#8280.
Contributor
Automated Reviewer SuggestionsBased on the
|
Matthew-DWM
marked this pull request as draft
November 23, 2026 17:49
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
largebinaryonly checked thes3://prefix, sos3://,s3:///object,s3://bucketands3://bucket/were accepted and failed later, when a stream called S3 with an empty bucket or object key. The constructor now parses the URI withurlparse, asget_bucket_name()andget_object_key()already do, and raisesValueErrornaming the URI when either part is empty. Mirroring the getters also rejectss3://bucket//ands3://bucket/?versionId=1, which a simple regex would accept.Behavior changes:
largebinary()with a misconfigured base URI (e.g.s3://) now fails on creation instead of on upload.LargeBinarystill checks only the prefix. A keyless URI built there now fails in the next Python operator, even one that only passes the tuple on, instead of later in S3. JVM parity is a follow-up.Any related issues, documentation, discussions?
Closes #8279. Builds on #8280 by @carloea2, which proposed the same
urlparsecheck; this adds the URI to the message, updates the docstring and widens the tests.Follow-up for the JVM side: #9625
How was this PR tested?
New parametrized tests in
test_large_binary.pycover six incomplete URIs (including both regex traps above), accepted URIs with edge-case keys (trailing slash, unicode), andlargebinary()with a misconfigured base URI. The new tests were written before the fix and all pass with it; 8 of them fail on main withDID NOT RAISE.From
amber, with Python 3.12, after runningbash bin/python-proto-gen.shfrom the repo root:The 3 failures are
test_python_ui_parameter_value_contract[timestamp-*], which fail the same way on unmodified main here because the machine is not on UTC. Ruff lint and formatting pass, and the URI check behaves identically on Python 3.13.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)