Commit
·
b89f914
1
Parent(s):
e8dfa3e
chore: Improve display name formatting in get_display_name function
Browse files
app.py
CHANGED
|
@@ -52,13 +52,16 @@ def navigate_dataset(dataset_ids, index, direction):
|
|
| 52 |
|
| 53 |
|
| 54 |
def get_display_name(collection_id):
|
| 55 |
-
#
|
| 56 |
parts = collection_id.split("/")
|
| 57 |
if len(parts) == 2:
|
| 58 |
owner, name = parts
|
|
|
|
| 59 |
name = re.sub(r"-[a-f0-9]{32}$", "", name)
|
| 60 |
return f"{owner}/{name}"
|
| 61 |
-
|
|
|
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
try:
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
def get_display_name(collection_id):
|
| 55 |
+
# Split the collection_id into parts
|
| 56 |
parts = collection_id.split("/")
|
| 57 |
if len(parts) == 2:
|
| 58 |
owner, name = parts
|
| 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 the format is unexpected, return the original
|
| 64 |
+
return collection_id
|
| 65 |
|
| 66 |
|
| 67 |
try:
|