From 68a0e68bcd1676a5000c215c38f1e461194a882e Mon Sep 17 00:00:00 2001 From: YimingWu Date: Mon, 24 Mar 2025 07:35:44 +0100 Subject: [PATCH] Fix #135999: Extensions: Remove emails in `bl_info['author']` Previously when an addon is expanded on the UI, the "Maintainer" string would be cut short until a `<` character, to prevent showing e-mail on the UI, however there could be more than one person/email entries in there so to prevent cutting short the string, now we use regex to take out the email part only, so full maintainer string is displayed. Pull Request: https://projects.blender.org/blender/blender/pulls/136031 --- scripts/addons_core/bl_pkg/bl_extension_ui.py | 2 +- scripts/addons_core/bl_pkg/bl_extension_utils.py | 3 ++- scripts/modules/addon_utils.py | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/addons_core/bl_pkg/bl_extension_ui.py b/scripts/addons_core/bl_pkg/bl_extension_ui.py index 9f82f8f4f8b..98d462627b2 100644 --- a/scripts/addons_core/bl_pkg/bl_extension_ui.py +++ b/scripts/addons_core/bl_pkg/bl_extension_ui.py @@ -532,7 +532,7 @@ def addons_panel_draw_items( del value if show_expanded: - item_maintainer = value.split("<", 1)[0].rstrip() if (value := bl_info["author"]) else "" + item_maintainer = value if (value := bl_info["author"]) else "" item_version = ".".join(str(x) for x in value) if (value := bl_info["version"]) else "" item_doc_url = bl_info["doc_url"] item_tracker_url = bl_info.get("tracker_url") diff --git a/scripts/addons_core/bl_pkg/bl_extension_utils.py b/scripts/addons_core/bl_pkg/bl_extension_utils.py index 78500a34302..496b8720635 100644 --- a/scripts/addons_core/bl_pkg/bl_extension_utils.py +++ b/scripts/addons_core/bl_pkg/bl_extension_utils.py @@ -1331,6 +1331,7 @@ class PkgManifest_Normalized(NamedTuple): error_fn(ex) return None + import re return PkgManifest_Normalized( name=field_name, tagline=field_tagline, @@ -1338,7 +1339,7 @@ class PkgManifest_Normalized(NamedTuple): type=field_type, # Remove the maintainers email while it's not private, showing prominently # could cause maintainers to get direct emails instead of issue tracking systems. - maintainer=field_maintainer.split("<", 1)[0].rstrip(), + maintainer=re.sub(r"\s*<.*?>", "", field_maintainer), license=license_info_to_text(field_license), # Optional. diff --git a/scripts/modules/addon_utils.py b/scripts/modules/addon_utils.py index dbb215bf791..3a92aa22439 100644 --- a/scripts/modules/addon_utils.py +++ b/scripts/modules/addon_utils.py @@ -712,6 +712,12 @@ def module_bl_info(mod, *, info_basis=None): _blender_manual_url_prefix(), ) + # Remove the maintainers email while it's not private, showing prominently + # could cause maintainers to get direct emails instead of issue tracking systems. + import re + if "author" in addon_info: + addon_info["author"] = re.sub(r"\s*<.*?>", "", addon_info["author"]) + addon_info["_init"] = None return addon_info