From 376008c705524380249ccf807536f06ee9bca7a3 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Wed, 19 Feb 2025 12:16:10 -0500 Subject: [PATCH 1/2] do not emit duplicate links if update --- wis2box-management/wis2box/pubsub/message.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/wis2box-management/wis2box/pubsub/message.py b/wis2box-management/wis2box/pubsub/message.py index 7a076c88..62b13439 100644 --- a/wis2box-management/wis2box/pubsub/message.py +++ b/wis2box-management/wis2box/pubsub/message.py @@ -154,19 +154,17 @@ def __init__(self, identifier: str, metadata_id: str, filepath: str, if self.datetime is None: LOGGER.warning('Missing data datetime') + link_rel = 'canonical' + + if operation == 'update': + link_rel = 'update' + links = [{ - 'rel': 'canonical', + 'rel': link_rel, 'type': mimetype, 'href': public_file_url, 'length': self.length }] - if operation == 'update': - links.append({ - 'rel': 'update', - 'type': mimetype, - 'href': public_file_url, - 'length': self.length - }) self.message = { 'id': str(uuid.uuid4()), From 329ab3a810acedad15e36bda8a5a7f5301c051b6 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Wed, 19 Feb 2025 12:58:49 -0500 Subject: [PATCH 2/2] update flake8 --- wis2box-management/wis2box/pubsub/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wis2box-management/wis2box/pubsub/message.py b/wis2box-management/wis2box/pubsub/message.py index 62b13439..27908058 100644 --- a/wis2box-management/wis2box/pubsub/message.py +++ b/wis2box-management/wis2box/pubsub/message.py @@ -158,7 +158,7 @@ def __init__(self, identifier: str, metadata_id: str, filepath: str, if operation == 'update': link_rel = 'update' - + links = [{ 'rel': link_rel, 'type': mimetype,