ImagingDataCommons / dicomweb-client

Python client for DICOMweb RESTful services
https://dicomweb-client.readthedocs.io
MIT License
109 stars 38 forks source link

Double trailing slash problem #71

Closed lambacini closed 1 year ago

lambacini commented 1 year ago

_get_transaction_url function cannot properly check if the value is null or empty.

https://github.com/herrmannlab/dicomweb-client/blob/a9d6b09a347d41b245d0bf2054ec323fdc7ddb33/src/dicomweb_client/web.py#L318 https://github.com/herrmannlab/dicomweb-client/blob/a9d6b09a347d41b245d0bf2054ec323fdc7ddb33/src/dicomweb_client/web.py#L321 this codes always return True, so it adds a double slash to the end of the address even if the url prefix is empty.

image

Related : https://github.com/Project-MONAI/MONAILabel/issues/1045#issue-1397521738

hackermd commented 1 year ago

Thank you @lambacini for reporting the issue.

I assume that the problem you are experiencing is due to the fact that the qido_url_prefix or wado_url_prefix arguments are not None. It appears that empty strings are passed to the constructor of DICOMwebClient (see here). I suggest improving the parsing of the MONAI Label app settings.

jlvahldiek commented 1 year ago

I raised https://github.com/Project-MONAI/MONAILabel/pull/1048 that may fix this.

lambacini commented 1 year ago

This issue has been fixed on the related project. maybe empty string control can be added for webclient. Thank you for your interest

hackermd commented 1 year ago

This issue has been fixed on the related project. maybe empty string control can be added for webclient.

I agree. We should add a check and raise a ValueError if the argument is an empty string. Thank you for the suggestion.

hackermd commented 1 year ago

Addressed with e05b59680b2de0c3a4ae94db70d1fb450649a3e9