diff --git a/lib/galaxy/model/store/__init__.py b/lib/galaxy/model/store/__init__.py index a8b515cc5c29..74f6fdb14189 100644 --- a/lib/galaxy/model/store/__init__.py +++ b/lib/galaxy/model/store/__init__.py @@ -32,7 +32,6 @@ TYPE_CHECKING, Union, ) -from urllib.parse import urlparse from bdbag import bdbag_api as bdb from boltons.iterutils import remap @@ -2659,11 +2658,10 @@ def _finalize(self): # upload output file to file source if not self.file_sources: raise Exception(f"Need self.file_sources but {type(self)} is missing it: {self.file_sources}.") - file_source_uri = urlparse(str(self.file_source_uri)) file_source_path = self.file_sources.get_file_source_path(self.file_source_uri) file_source = file_source_path.file_source assert os.path.exists(self.out_file) - self.file_source_uri = f"{file_source_uri.scheme}://{file_source_uri.netloc}" + file_source.write_from( + self.file_source_uri = f"{file_source.get_scheme()}://{file_source.get_prefix()}" + file_source.write_from( file_source_path.path, self.out_file, user_context=self.user_context ) shutil.rmtree(self.temp_output_dir) diff --git a/lib/galaxy/tools/imp_exp/export_history.py b/lib/galaxy/tools/imp_exp/export_history.py index c16c4768db56..9aef3073c903 100644 --- a/lib/galaxy/tools/imp_exp/export_history.py +++ b/lib/galaxy/tools/imp_exp/export_history.py @@ -67,7 +67,9 @@ def _write_to_destination(file_sources_path: str, out_file: str, destination_uri file_source_path = file_sources.get_file_source_path(destination_uri) file_source = file_source_path.file_source assert os.path.exists(out_file) - return file_source.write_from(file_source_path.path, out_file) + return f"{file_source.get_scheme()}://{file_source.get_prefix()}" + file_source.write_from( + file_source_path.path, out_file + ) def get_file_sources(file_sources_path: str) -> ConfiguredFileSources: diff --git a/test/unit/files/_util.py b/test/unit/files/_util.py index 0a4a77ee14ff..5640a26635b6 100644 --- a/test/unit/files/_util.py +++ b/test/unit/files/_util.py @@ -151,10 +151,13 @@ def write_from( user_context: OptionalUserContext = None, ) -> str: file_source_path = file_sources.get_file_source_path(uri) + file_source = file_source_path.file_source with tempfile.NamedTemporaryFile(mode="w") as f: f.write(content) f.flush() - return file_source_path.file_source.write_from(file_source_path.path, f.name, user_context=user_context) + return f"{file_source.get_scheme()}://{file_source.get_prefix()}" + file_source.write_from( + file_source_path.path, f.name, user_context=user_context + ) def configured_file_sources(conf_file, file_sources_config: Optional[FileSourcePluginsConfig] = None):