mirror of
				https://github.com/clearml/clearml
				synced 2025-06-26 18:16:07 +00:00 
			
		
		
		
	Bugfix for storage with path substitutions (#877)
* Bugfix: canonize url in StorageHelper.exists_file() * Added fixes for path substitutions: StorageManager to use orginal path in metadata Helper to use path rewrites in list operations * Fixed a copy-paste error Co-authored-by: eajechiloae <97950284+eugen-ajechiloae-clearml@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									b4cb44bf1b
								
							
						
					
					
						commit
						7d80406290
					
				| @ -784,6 +784,7 @@ class StorageHelper(object): | ||||
|             Listed relative to the base path. | ||||
|         """ | ||||
|         if prefix: | ||||
|             prefix = self._canonize_url(prefix) | ||||
|             if prefix.startswith(self._base_url): | ||||
|                 prefix = prefix[len(self._base_url):] | ||||
|                 if self._base_url != "file://": | ||||
| @ -1240,6 +1241,7 @@ class StorageHelper(object): | ||||
|                 pass | ||||
| 
 | ||||
|     def exists_file(self, remote_url): | ||||
|         remote_url = self._canonize_url(remote_url) | ||||
|         object_name = self._normalize_object_name(remote_url) | ||||
|         return self._driver.exists_file( | ||||
|             container_name=self._container.name if self._container else "", object_name=object_name | ||||
|  | ||||
| @ -481,8 +481,9 @@ class StorageManager(object): | ||||
|         if not obj: | ||||
|             return None | ||||
|         metadata = helper.get_object_metadata(obj) | ||||
|         if return_full_path and not metadata["name"].startswith(helper.base_url): | ||||
|             metadata["name"] = helper.base_url + ("/" if not helper.base_url.endswith("/") else "") + metadata["name"] | ||||
|         base_url = helper._resolve_base_url(remote_url) | ||||
|         if return_full_path and not metadata["name"].startswith(base_url): | ||||
|             metadata["name"] = base_url + ("/" if not base_url.endswith("/") else "") + metadata["name"] | ||||
|         return metadata | ||||
| 
 | ||||
|     @classmethod | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user