Skip to content

Commit 37f9e05

Browse files
authored
Merge pull request #978 from mguidon/hotfix_storage_fix_deep_copy_path
Filename was missing in path to storage
2 parents 8a715cd + b65ed67 commit 37f9e05

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

services/storage/src/simcore_service_storage/dsm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ async def copy_file_datcore_s3(self, user_id: str, dest_uuid: str, source_uuid:
469469
if resp.status > 299:
470470
_response_text = await resp.text()
471471

472+
return dest_uuid
473+
472474
async def copy_file(self, user_id: str, dest_location: str, dest_uuid: str, source_location: str, source_uuid: str):
473475
if source_location == SIMCORE_S3_STR:
474476
if dest_location == DATCORE_STR:
@@ -558,7 +560,7 @@ async def deep_copy_project_simcore_s3(self, user_id: str, source_project, desti
558560
src = output["path"]
559561
dest = str(Path(dest_folder) / node_id)
560562
logger.info("Need to copy %s to %s", src, dest)
561-
await self.copy_file_datcore_s3(user_id=user_id, dest_uuid=dest, source_uuid=src, filename_missing=True)
563+
dest = await self.copy_file_datcore_s3(user_id=user_id, dest_uuid=dest, source_uuid=src, filename_missing=True)
562564
# and change the dest project accordingly
563565
output["store"] = 0
564566
output['path'] = dest

services/storage/tests/test_dsm.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ async def test_deep_copy_project_simcore_s3(dsm_fixture, s3_client, postgres_ser
379379
utils.create_full_tables(url=postgres_service_url)
380380

381381
path_in_datcore = datcore_structured_testbucket["file_id3"]
382+
file_name_in_datcore = Path(datcore_structured_testbucket["filename3"]).name
382383
user_id = USER_ID
383384

384385
source_project = {
@@ -456,8 +457,10 @@ async def test_deep_copy_project_simcore_s3(dsm_fixture, s3_client, postgres_ser
456457
node_mapping[node_id] = key
457458

458459
status = await dsm.deep_copy_project_simcore_s3(user_id, source_project, destination_project, node_mapping)
460+
459461
new_path = destination_project["workbench"]["deep-copy-uuid-48eb-a9d2-aaad6b72400a"]["outputs"]["outFile"]["path"]
460462
assert new_path != path_in_datcore
463+
assert Path(new_path).name == file_name_in_datcore
461464
files = await dsm.list_files(user_id=user_id, location=SIMCORE_S3_STR)
462465
assert len(files) == 3
463466
# one of the files in s3 should be the dowloaded one from datcore

0 commit comments

Comments
 (0)