bolkedebruin commented on code in PR #36410:
URL: https://github.com/apache/airflow/pull/36410#discussion_r1436921924


##########
airflow/io/path.py:
##########
@@ -173,10 +176,14 @@ def bucket(self) -> str:
     @property
     def key(self) -> str:
         if self._url:
-            return self._url.path
+            return self._url.path.lstrip(self.sep)

Review Comment:
   Oh yes, lstrip removes all slashes while only 1 needs to be removed. I do 
prefer not to distinguish based of filesystem, as we call our implementation 
ObjectStoragePath and document it to have object storage semantics.
   
   But indeed here I think it needs to be
   
   ```python
       if s.startswith('/'):
           s = s[1:]
   ```
   
   edit: maybe not: `objectstorage.path` gives you the real path, the key is 
without the slash:
   
   ```python
   b = ObjectStoragePath("file:///tmp/test.json")
   b.bucket # empty
   b.path # /tmp/test.json
   b.key # tmp/test.json
   ```
   
   The above seems to me to be the correct semantics. wdyt?



-- 
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]

Reply via email to