1212from urllib .request import url2pathname
1313
1414from fsspec .callbacks import DEFAULT_CALLBACK , Callback
15- from fsspec .implementations .local import LocalFileSystem
1615from PIL import Image
1716from pydantic import Field , field_validator
1817
@@ -283,9 +282,8 @@ def get_uri(self):
283282 def get_path (self ) -> str :
284283 """Returns file path."""
285284 path = unquote (self .get_uri ())
286- fs = self .get_fs ()
287- if isinstance (fs , LocalFileSystem ):
288- # Drop file:// protocol
285+ source = urlparse (self .source )
286+ if source .scheme == "file" :
289287 path = urlparse (path ).path
290288 path = url2pathname (path )
291289 return path
@@ -300,13 +298,10 @@ def get_destination_path(self, output: str, placement: ExportPlacement) -> str:
300298 elif placement == "etag" :
301299 path = f"{ self .etag } { self .get_file_suffix ()} "
302300 elif placement == "fullpath" :
303- fs = self .get_fs ()
304- if isinstance (fs , LocalFileSystem ):
305- path = unquote (self .get_full_name ())
306- else :
307- path = (
308- Path (urlparse (self .source ).netloc ) / unquote (self .get_full_name ())
309- ).as_posix ()
301+ path = unquote (self .get_full_name ())
302+ source = urlparse (self .source )
303+ if source .scheme and source .scheme != "file" :
304+ path = posixpath .join (source .netloc , path )
310305 elif placement == "checksum" :
311306 raise NotImplementedError ("Checksum placement not implemented yet" )
312307 else :
0 commit comments