From 4861c7d40575b39447522af3530d4f7e49a60c8a Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 5 Feb 2025 21:15:41 +0700 Subject: [PATCH] Fixed tags plugin crashing on numeric title --- material/plugins/tags/__init__.py | 4 +++- src/plugins/tags/__init__.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/material/plugins/tags/__init__.py b/material/plugins/tags/__init__.py index 8a8ee2e01..6a435ed2e 100644 --- a/material/plugins/tags/__init__.py +++ b/material/plugins/tags/__init__.py @@ -37,7 +37,9 @@ def tag_name_casefold(tag: Tag, *args): # Return item title for sorting def item_title(mapping: Mapping): - return mapping.item.title + # Note that this must be coerced to a string, as the title might be sourced + # from metadata, which can be of any type - see https://t.ly/1AXyo + return str(mapping.item.title) # Return item URL for sorting def item_url(mapping: Mapping): diff --git a/src/plugins/tags/__init__.py b/src/plugins/tags/__init__.py index 8a8ee2e01..6a435ed2e 100644 --- a/src/plugins/tags/__init__.py +++ b/src/plugins/tags/__init__.py @@ -37,7 +37,9 @@ def tag_name_casefold(tag: Tag, *args): # Return item title for sorting def item_title(mapping: Mapping): - return mapping.item.title + # Note that this must be coerced to a string, as the title might be sourced + # from metadata, which can be of any type - see https://t.ly/1AXyo + return str(mapping.item.title) # Return item URL for sorting def item_url(mapping: Mapping):