@@ -36,7 +36,7 @@ def _parse_tapis_uri(tapis_uri: str) -> (str, str):
3636 try :
3737 parsed = urllib .parse .urlparse (tapis_uri )
3838 system_id = parsed .netloc
39- path = parsed .path .lstrip ("/" ) if parsed .path else ""
39+ path = urllib . parse . unquote ( parsed .path .lstrip ("/" ) ) if parsed .path else ""
4040 if not system_id :
4141 raise ValueError (f"Invalid Tapis URI: '{ tapis_uri } '. Missing system ID." )
4242 return system_id , path
@@ -316,26 +316,24 @@ def get_ds_path_uri(t: Tapis, path: str, verify_exists: bool = False) -> str:
316316 print (f"Verifying existence of translated path: { input_uri } " )
317317 try :
318318 system_id , remote_path = _parse_tapis_uri (input_uri )
319- # Decode the path part for the listFiles call, as it expects unencoded paths
320- decoded_remote_path = urllib .parse .unquote (remote_path )
321- print (f"Checking system '{ system_id } ' for path '{ decoded_remote_path } '..." )
319+ print (f"Checking system '{ system_id } ' for path '{ remote_path } '..." )
322320 # Use limit=1 for efficiency, we only care if it *exists*
323321 # Note: listFiles might return successfully for the *parent* directory
324322 # if the final component doesn't exist. A more robust check might
325323 # involve checking the result count or specific item name, but this
326324 # basic check catches non-existent parent directories.
327- t .files .listFiles (systemId = system_id , path = decoded_remote_path , limit = 1 )
325+ t .files .listFiles (systemId = system_id , path = remote_path , limit = 1 )
328326 print (f"Verification successful: Path exists." )
329327 except BaseTapyException as e :
330328 # Specifically check for 404 on the listFiles call
331329 if hasattr (e , "response" ) and e .response and e .response .status_code == 404 :
332330 raise FileOperationError (
333- f"Verification failed: Path '{ decoded_remote_path } ' does not exist on system '{ system_id } '. Translated URI: { input_uri } "
331+ f"Verification failed: Path '{ remote_path } ' does not exist on system '{ system_id } '. Translated URI: { input_uri } "
334332 ) from e
335333 else :
336334 # Re-raise other Tapis errors encountered during verification
337335 raise FileOperationError (
338- f"Verification error for path '{ decoded_remote_path } ' on system '{ system_id } ': { e } "
336+ f"Verification error for path '{ remote_path } ' on system '{ system_id } ': { e } "
339337 ) from e
340338 except (
341339 ValueError
0 commit comments