Skip to content

Commit 03b043e

Browse files
authored
šŸ› Restores compatibility with deprecated storage API used in legacy services (#5679)
1 parent f4a365c commit 03b043e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

ā€Žservices/storage/src/simcore_service_storage/handlers_files.pyā€Ž

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,18 @@ async def get_file_metadata(request: web.Request) -> web.Response:
9393
file_id=path_params.file_id,
9494
)
9595
except FileMetaDataNotFoundError:
96-
# NOTE: This is what happens Larry... data must be an empty {} or else some old
97-
# dynamic services will FAIL (sic)
98-
# TODO: once all legacy services are gone, remove the try except, it will default to 404
96+
# NOTE: LEGACY compatibility
97+
# This is what happens Larry... data must be an empty {} or else some old dynamic services will FAIL (sic)
98+
# Cannot remove until we retire all legacy services
99+
# https://github.com/ITISFoundation/osparc-simcore/issues/5676
100+
# https://github.com/ITISFoundation/osparc-simcore/blob/cfdf4f86d844ebb362f4f39e9c6571d561b72897/services/storage/client-sdk/python/simcore_service_storage_sdk/models/file_meta_data_enveloped.py#L34
101+
99102
return web.json_response(
100-
{"error": "No result found", "data": None}, dumps=json_dumps
103+
{"error": "No result found", "data": {}}, dumps=json_dumps
101104
)
102105

103106
if request.headers.get("User-Agent") == "OpenAPI-Generator/0.1.0/python":
104-
# LEGACY compatiblity with API v0.1.0
107+
# NOTE: LEGACY compatiblity with API v0.1.0
105108
# SEE models used in sdk in:
106109
# https://github.com/ITISFoundation/osparc-simcore/blob/cfdf4f86d844ebb362f4f39e9c6571d561b72897/services/storage/client-sdk/python/simcore_service_storage_sdk/models/file_meta_data_enveloped.py#L34
107110
# https://github.com/ITISFoundation/osparc-simcore/blob/cfdf4f86d844ebb362f4f39e9c6571d561b72897/services/storage/client-sdk/python/simcore_service_storage_sdk/models/file_meta_data_type.py#L34

ā€Žservices/storage/tests/unit/test_handlers_files_metadata.pyā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ async def test_get_file_metadata(
128128

129129
# NOTE: This needs to be a Ok response with empty data until ALL legacy services are gone, then it should be changed to 404! see test above
130130
assert response.status == status.HTTP_200_OK
131-
assert await response.json() == {"data": None, "error": "No result found"}
131+
assert await response.json() == {"data": {}, "error": "No result found"}
132132

133133
# now add some stuff there
134134
NUM_FILES = 10

0 commit comments

Comments
Ā (0)