From 6a1a0d4f739d261dde2ae2e07d9985482b2c1e34 Mon Sep 17 00:00:00 2001 From: Rohan Girish Date: Thu, 22 Jan 2026 15:01:24 +0100 Subject: [PATCH 1/3] Sanitize input string Fixes the issue of a trailing whitespace leading to the method crashing. --- src/imcflibs/imagej/omerotools.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/imcflibs/imagej/omerotools.py b/src/imcflibs/imagej/omerotools.py index 7dad756f..23706b56 100644 --- a/src/imcflibs/imagej/omerotools.py +++ b/src/imcflibs/imagej/omerotools.py @@ -57,6 +57,11 @@ def parse_url(client, omero_str): >>> for wrapper in img_wrappers: >>> imp = wpr.toImagePlus(client) """ + # Sanitize the string + if omero_str is None: + return [] + omero_str = omero_str.strip() + image_ids = [] dataset_ids = [] image_wpr_list = [] From bec6f5ae2cf2194deacae7cf21c8bad57d58317c Mon Sep 17 00:00:00 2001 From: Rohan Girish Date: Thu, 22 Jan 2026 15:26:17 +0100 Subject: [PATCH 2/3] Handle empty input string gracefully --- src/imcflibs/imagej/omerotools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/imcflibs/imagej/omerotools.py b/src/imcflibs/imagej/omerotools.py index 23706b56..0cb878c0 100644 --- a/src/imcflibs/imagej/omerotools.py +++ b/src/imcflibs/imagej/omerotools.py @@ -57,11 +57,12 @@ def parse_url(client, omero_str): >>> for wrapper in img_wrappers: >>> imp = wpr.toImagePlus(client) """ + if omero_str is None or str(omero_str).strip() == "": + raise ValueError("No OMERO link or image ID provided.") + # Sanitize the string - if omero_str is None: - return [] omero_str = omero_str.strip() - + image_ids = [] dataset_ids = [] image_wpr_list = [] From 2eb8ee2abdcd43680799ecc1376a0d4d61e6856a Mon Sep 17 00:00:00 2001 From: Rohan Girish Date: Thu, 22 Jan 2026 16:34:53 +0100 Subject: [PATCH 3/3] Remove checking for None, redundant --- src/imcflibs/imagej/omerotools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imcflibs/imagej/omerotools.py b/src/imcflibs/imagej/omerotools.py index 0cb878c0..856c5a57 100644 --- a/src/imcflibs/imagej/omerotools.py +++ b/src/imcflibs/imagej/omerotools.py @@ -57,7 +57,7 @@ def parse_url(client, omero_str): >>> for wrapper in img_wrappers: >>> imp = wpr.toImagePlus(client) """ - if omero_str is None or str(omero_str).strip() == "": + if not str(omero_str).strip(): raise ValueError("No OMERO link or image ID provided.") # Sanitize the string