Skip to content

Commit 4861c7d

Browse files
committed
Fixed tags plugin crashing on numeric title
1 parent a890d6e commit 4861c7d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

material/plugins/tags/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def tag_name_casefold(tag: Tag, *args):
3737

3838
# Return item title for sorting
3939
def item_title(mapping: Mapping):
40-
return mapping.item.title
40+
# Note that this must be coerced to a string, as the title might be sourced
41+
# from metadata, which can be of any type - see https://t.ly/1AXyo
42+
return str(mapping.item.title)
4143

4244
# Return item URL for sorting
4345
def item_url(mapping: Mapping):

src/plugins/tags/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def tag_name_casefold(tag: Tag, *args):
3737

3838
# Return item title for sorting
3939
def item_title(mapping: Mapping):
40-
return mapping.item.title
40+
# Note that this must be coerced to a string, as the title might be sourced
41+
# from metadata, which can be of any type - see https://t.ly/1AXyo
42+
return str(mapping.item.title)
4143

4244
# Return item URL for sorting
4345
def item_url(mapping: Mapping):

0 commit comments

Comments
 (0)