Repository navigation
escape bucket in downloadURLFromMetadataDictionary - #16529
Conversation
Using Gemini Code AssistThe 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
Customization To customize the 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 Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request ensures that the bucket name is properly cast to a string and percent-escaped when constructing the download URL, and adds a unit test to verify this behavior. The reviewer suggested using a guard let statement to safely unwrap both bucket and path instead of using fallback error strings, which would allow the method to fail gracefully by returning nil if they are missing.
downloadURLFromMetadataDictionary interpolates the bucket from the fetch response straight into the URL path while the object name goes through GCSEscapedString, so a bucket value carrying a path delimiter like "#" or "?" makes percentEncodedPath raise, one carrying a "/" rewrites the /o/ segment of the returned download URL, and a non-string JSON value is stringified as its Swift description. StorageUtils.encodedURL(for:) escapes the bucket the same way, so this is the one path that skips it. Read the bucket as a String and run it through GCSEscapedString, matching the object handling one line down.