GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(storage): skip downloading blobs whose name contain `":" ` eg: `C:` `D:` etc when application runs in Windows. by chandra-siri · Pull Request #1774 · googleapis/python-storage

This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Conversation

@chandra-siri

@chandra-siri chandra-siri commented Mar 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

skip downloading blobs whose name contain ":" eg: C: D: etc when application runs in Windows.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction
chandra-siri added 2 commits March 17, 2026 14:38
@chandra-siri
feat(storage): support returning skipped items as UserWarning in down…
347c6ee
…load_many_to_path
@chandra-siri
feat(storage): raise InvalidPathError for Windows full paths with ':'…
948de5f
… in download_many_to_path
@chandra-siri
chandra-siri requested review from a team as code owners March 17, 2026 16:01
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/python-storage API. labels Mar 17, 2026
@chandra-siri chandra-siri assigned krishnamd-jkp Mar 17, 2026
@gemini-code-assist

gemini-code-assist Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of path handling within the storage client, specifically addressing an edge case with Windows full paths containing colons. It introduces a dedicated InvalidPathError and modifies the download process to gracefully handle such malformed paths by skipping the problematic download and issuing a user warning, thereby improving the overall user experience and preventing unexpected failures.

Highlights

  • New Exception Type: Introduced InvalidPathError to specifically handle cases where a provided path string is malformed.
  • Windows Path Validation: Modified the _resolve_path function to detect and raise InvalidPathError when a Windows-style path containing a colon (e.g., "C:\file.txt") is encountered, preventing its use in downloads.
  • Graceful Error Handling: Updated download_many_to_path to catch InvalidPathError during path resolution, issue a UserWarning for the problematic blob, and continue processing other blobs instead of failing the entire operation.
  • Unit Tests: Added new unit tests to verify that _resolve_path correctly raises InvalidPathError on Windows for invalid paths and that download_many_to_path properly handles this exception by issuing a warning.
Changelog
  • google/cloud/storage/exceptions.py
    • Added a new exception class, InvalidPathError, for malformed path strings.
  • google/cloud/storage/transfer_manager.py
    • Imported the new InvalidPathError.
    • Modified _resolve_path to raise InvalidPathError if a Windows path contains a colon.
    • Implemented a try-except block in download_many_to_path to catch InvalidPathError, issue a UserWarning, and skip the problematic blob.
    • Removed an extra blank line.
  • tests/unit/test_transfer_manager.py
    • Added test__resolve_path_raises_invalid_path_error_on_windows to verify the new path validation logic.
    • Added test_download_many_to_path_raises_invalid_path_error to confirm that download_many_to_path correctly handles InvalidPathError with a warning.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot]
gemini-code-assist Bot reviewed Mar 17, 2026
View reviewed changes

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an InvalidPathError exception to handle Windows paths with colons in the transfer_manager.py file. The _resolve_path function now raises this exception when encountering such paths on Windows, and the download_many_to_path function catches this exception, issues a warning, and skips the download. Unit tests have been added to verify the new functionality. The review comments suggest further opportunities to improve code readability, error messaging, and test robustness.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/unit/test_transfer_manager.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/transfer_manager.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/transfer_manager.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_transfer_manager.py
Comment on lines +517 to +523
def test__resolve_path_raises_invalid_path_error_on_windows():
from google.cloud.storage.transfer_manager import _resolve_path, InvalidPathError

with mock.patch("os.name", "nt"):
with pytest.raises(InvalidPathError) as exc_info:
_resolve_path("C:\\target", "C:\\target\\file.txt")
assert "cannot be downloaded into" in str(exc_info.value)

@gemini-code-assist gemini-code-assist Bot Mar 17, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

medium

The assertion message cannot be downloaded into is too specific and duplicates the implementation detail. It would be better to assert a more general message indicating that the path is invalid, which is less prone to break if the implementation changes.

        with pytest.raises(InvalidPathError) as exc_info:
            _resolve_path("C:\\target", "C:\\target\\file.txt")
        assert "Invalid path" in str(exc_info.value)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chandra-siri

chandra-siri commented Mar 17, 2026

Copy link
Copy Markdown
Collaborator Author

/gcbrun(948de5f)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chandra-siri
test(storage): update InvalidPathError test to use native triggers
0db308d
@chandra-siri chandra-siri changed the title feat(storage): raise InvalidPathError for Windows full paths with ':' fix(storage): skip downloading blobs whose name contain ":" eg: C: D: etc when application runs in Windows. Mar 17, 2026
cpriti-os
cpriti-os approved these changes Mar 18, 2026
View reviewed changes
Base automatically changed from fix-download-many-warnings to main March 18, 2026 12:13
@chandra-siri
Merge branch 'main' into skip_invalid_windows_path
82d9f35
@chandra-siri
chandra-siri merged commit 5581988 into main Mar 18, 2026
6 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@chandra-siri
chandra-siri deleted the skip_invalid_windows_path branch March 18, 2026 13:40
@chandra-siri chandra-siri mentioned this pull request Mar 18, 2026
chore: librarian release pull request: 20260318T145147Z #1776
Merged
chandra-siri added a commit that referenced this pull request Mar 18, 2026
@chandra-siri
chore: librarian release pull request: 20260318T145147Z (#1776)
8b7fbde
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v1.0.2-0.20251119154421-36c3e21ad3ac
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:8e2c32496077054105bd06c54a59d6a6694287bc053588e24debe6da6920ad91
<details><summary>google-cloud-storage: 3.10.0</summary>

##
[3.10.0](v3.9.0...v3.10.0)
(2026-03-18)

### Features

* [Bucket Encryption Enforcement] add support for bucket encryption
enforcement config (#1742)
([2a6e8b0](2a6e8b0))

### Perf Improvments

* [Rapid Buckets Reads] Use raw proto access for read resumption
strategy (#1764)
([14cfd61](14cfd61))
* [Rapid Buckets Benchmarks] init mp pool & grpc client once, use
os.sched_setaffinity (#1751)
([a9eb82c](a9eb82c))
* [Rapid Buckets Writes] don't flush at every append, results in bad
perf (#1746)
([ab62d72](ab62d72))


### Bug Fixes

* [Windows] skip downloading blobs whose name contain `":" ` eg: `C:`
`D:` etc when application runs in Windows. (#1774)
([5581988](5581988))
* [Path Traversal] Prevent path traversal in `download_many_to_path`
(#1768)
([700fec3](700fec3))
* [Rapid Buckets] pass token correctly, '&' instead of ',' (#1756)
([d8dd1e0](d8dd1e0))


</details>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
@cpriti-os cpriti-os cpriti-os approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@krishnamd-jkp krishnamd-jkp

Labels

api: storage Issues related to the googleapis/python-storage API. size: m Pull request size is medium.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@chandra-siri @cpriti-os @krishnamd-jkp
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.