Skip to content

fix: detect original_url before operator guard to fix encoding with explicit operators#678

Merged
mangelajo merged 1 commit into
mainfrom
opendal-encode
May 13, 2026
Merged

fix: detect original_url before operator guard to fix encoding with explicit operators#678
mangelajo merged 1 commit into
mainfrom
opendal-encode

Conversation

@bennyz
Copy link
Copy Markdown
Member

@bennyz bennyz commented May 12, 2026

When callers pass an explicit operator (e.g. after resolving via operator_for_path()), the original_url detection was skipped because it was nested inside if operator is None. This caused HTTP URLs to go through OpenDAL presign_read, mangling percent-encoded paths. Move the URL check before the guard in all three methods.

…xplicit operators

When callers pass an explicit operator (e.g. after resolving via
operator_for_path()), the original_url detection was skipped because it
was nested inside `if operator is None`. This caused HTTP URLs to go
through OpenDAL presign_read, mangling percent-encoded paths. Move the
URL check before the guard in all three methods.

Assisted-by: claude-opus-4.6
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 938258ae-1453-452e-a0de-bc28ad2851ee

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch opendal-encode

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bennyz bennyz added the build-pr-images/jumpstarter request to build only the jumpstarter image from PR label May 12, 2026
@github-actions
Copy link
Copy Markdown

Container Images

The following container images have been built for this PR:

Image URI
jumpstarter quay.io/jumpstarter-dev/jumpstarter:pr-678

Images expire after 7 days.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
python/packages/jumpstarter-driver-opendal/jumpstarter_driver_opendal/driver_test.py (1)

386-393: ⚡ Quick win

Consider adding test coverage for StorageMuxFlasherClient.flash.

The fix in client.py (lines 775-776) applies the same pattern to StorageMuxFlasherClient.flash, but there's no explicit test validating that this method also preserves encoding when given an explicit operator. While the logic is identical to FlasherClient._flash_single, adding a test would increase confidence and prevent regressions.

📝 Suggested test to add
def test_storage_mux_flasher_http_with_explicit_operator():
    """StorageMuxFlasherClient.flash must use original_url bypass even when operator is passed explicitly."""
    with serve(MockStorageMuxFlasher()) as flasher:
        with _http_path_recording_server() as (port, received_paths):
            url = f"http://127.0.0.1:{port}/path%40encoded/file.bin"
            explicit_operator = Operator("http", endpoint=f"http://127.0.0.1:{port}")
            flasher.flash(url, operator=explicit_operator)
            _assert_encoding_preserved(received_paths)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@python/packages/jumpstarter-driver-opendal/jumpstarter_driver_opendal/driver_test.py`
around lines 386 - 393, Add a new test mirroring
test_flash_http_with_explicit_operator but exercising
StorageMuxFlasherClient.flash: create a test named
test_storage_mux_flasher_http_with_explicit_operator that uses
serve(MockStorageMuxFlasher()) and _http_path_recording_server(), constructs url
= f"http://127.0.0.1:{port}/path%40encoded/file.bin", creates explicit_operator
= Operator("http", endpoint=f"http://127.0.0.1:{port}"), calls
flasher.flash(url, operator=explicit_operator) and then calls
_assert_encoding_preserved(received_paths) to verify encoding is preserved for
StorageMuxFlasherClient.flash.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@python/packages/jumpstarter-driver-opendal/jumpstarter_driver_opendal/driver_test.py`:
- Around line 386-393: Add a new test mirroring
test_flash_http_with_explicit_operator but exercising
StorageMuxFlasherClient.flash: create a test named
test_storage_mux_flasher_http_with_explicit_operator that uses
serve(MockStorageMuxFlasher()) and _http_path_recording_server(), constructs url
= f"http://127.0.0.1:{port}/path%40encoded/file.bin", creates explicit_operator
= Operator("http", endpoint=f"http://127.0.0.1:{port}"), calls
flasher.flash(url, operator=explicit_operator) and then calls
_assert_encoding_preserved(received_paths) to verify encoding is preserved for
StorageMuxFlasherClient.flash.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b26d6462-7c3e-49d6-b191-d3f738b819c6

📥 Commits

Reviewing files that changed from the base of the PR and between 72e0ed8 and 79b7fae.

📒 Files selected for processing (2)
  • python/packages/jumpstarter-driver-opendal/jumpstarter_driver_opendal/client.py
  • python/packages/jumpstarter-driver-opendal/jumpstarter_driver_opendal/driver_test.py

@bennyz bennyz marked this pull request as ready for review May 13, 2026 05:25
@bennyz bennyz requested a review from mangelajo May 13, 2026 05:25
@mangelajo mangelajo merged commit a0dbedb into main May 13, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-pr-images/jumpstarter request to build only the jumpstarter image from PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants