File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,23 @@ def __init__(
24
24
25
25
self .filesystem = filesystem
26
26
27
+ def _get_relative_path (self , path : str ) -> str :
28
+ if path [: len (self .sep )] == self .sep :
29
+ return path [len (self .sep ) :]
30
+ return path
31
+
27
32
def _add_fs_prefix (self , path : Union [str , Path ]) -> Union [str , Sequence [str ]]:
28
33
if isinstance (path , (str , Path )):
29
34
path = stringify_path (path )
30
35
protocol , path = split_protocol (path )
31
- path = os .path .join (self .prefix , path )
36
+
37
+ path = self ._get_relative_path (path )
38
+
39
+ if self .prefix == self .sep :
40
+ path = f"{ self .sep } { path } " # don't add twice the same sep
41
+ else :
42
+ path = f"{ self .prefix } { self .sep } { path } "
43
+
32
44
return protocol + "://" + path if protocol is not None else path
33
45
elif isinstance (path , Iterable ):
34
46
return [self ._add_fs_prefix (x ) for x in path ]
You can’t perform that action at this time.
0 commit comments