gemini-code-assist[bot] commented on code in PR #35849:
URL: https://github.com/apache/beam/pull/35849#discussion_r2268447125
##########
sdks/python/apache_beam/yaml/yaml_provider.py:
##########
@@ -1531,12 +1531,18 @@ def _join_url_or_filepath(base, path):
return path
base_scheme = urllib.parse.urlparse(base, '').scheme
path_scheme = urllib.parse.urlparse(path, base_scheme).scheme
- if path_scheme != base_scheme:
+ if path_scheme != base_scheme or path.startswith(path_scheme + "://"):
+ # path has its own scheme or path is an absolute path
return path
Review Comment:

The logic here to detect if `path` is an absolute URI can be simplified.
Instead of calculating `path_scheme` and using a `startswith` check, you can
more robustly and clearly determine if `path` is an absolute URI by checking
`urllib.parse.urlparse(path).scheme` directly.
This makes the code's intent more explicit and removes the need for the
`path_scheme` variable, simplifying the function.
```suggestion
if urllib.parse.urlparse(path).scheme:
return path
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]