From 96f056cb0db77c00c16bba97b5c0eb7cc2843fc1 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 21 Nov 2025 15:32:30 -0500 Subject: [PATCH 1/2] BF: strip away any prefix before ":" while determining numeric dandiset identifier We have it confusing, as the identifier in the client model is just the numeric part. We should have called it differently from the metadata model identifier --- dandi/dandiset.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dandi/dandiset.py b/dandi/dandiset.py index 63ebbfb1b..b53113edf 100644 --- a/dandi/dandiset.py +++ b/dandi/dandiset.py @@ -139,9 +139,9 @@ def _get_identifier(metadata: dict) -> str | None: id_ = str(id_.get("value", "")) elif id_ is not None: assert isinstance(id_, str) - if id_.startswith("DANDI:"): - # result of https://github.com/dandi/dandi-cli/pull/348 which - id_ = id_[len("DANDI:") :] + # result of https://github.com/dandi/dandi-cli/pull/348 which ??? + # TODO: RF to avoid this evil!!! + id_ = id_.split(":")[-1] assert id_ is None or isinstance(id_, str) return id_ From 176eac0a18d242190ce85e1d09b483d92cc7994d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 24 Nov 2025 15:40:18 -0500 Subject: [PATCH 2/2] Limit split on : to a single element Co-authored-by: Isaac To --- dandi/dandiset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dandi/dandiset.py b/dandi/dandiset.py index b53113edf..7d5e7f935 100644 --- a/dandi/dandiset.py +++ b/dandi/dandiset.py @@ -141,7 +141,7 @@ def _get_identifier(metadata: dict) -> str | None: assert isinstance(id_, str) # result of https://github.com/dandi/dandi-cli/pull/348 which ??? # TODO: RF to avoid this evil!!! - id_ = id_.split(":")[-1] + id_ = id_.split(":", maxsplit=1)[-1] assert id_ is None or isinstance(id_, str) return id_