Commit
•
185bd85
1
Parent(s):
b89f914
fix regex
Browse files
app.py
CHANGED
@@ -52,15 +52,12 @@ def navigate_dataset(dataset_ids, index, direction):
|
|
52 |
|
53 |
|
54 |
def get_display_name(collection_id):
|
55 |
-
#
|
56 |
-
|
57 |
-
if
|
58 |
-
|
59 |
-
# Remove the ID part (assumed to be 32 characters of hexadecimal after the last hyphen)
|
60 |
-
name = re.sub(r"-[a-f0-9]{32}$", "", name)
|
61 |
-
return f"{owner}/{name}"
|
62 |
else:
|
63 |
-
# If
|
64 |
return collection_id
|
65 |
|
66 |
|
|
|
52 |
|
53 |
|
54 |
def get_display_name(collection_id):
|
55 |
+
# Pattern to match username/repo-name with an optional ID of 16 or more hexadecimal characters
|
56 |
+
pattern = r"^(.+?)-([a-f0-9]{16,})$"
|
57 |
+
if match := re.match(pattern, collection_id):
|
58 |
+
return match[1]
|
|
|
|
|
|
|
59 |
else:
|
60 |
+
# If no match, return the original
|
61 |
return collection_id
|
62 |
|
63 |
|