From 31bc320fd11a4f09cc7d8712d6d9a3f7d76f6800 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sat, 10 May 2025 13:08:23 -0500 Subject: [PATCH] pluginupdate: fix AttributeError when handling HTTPResponse objects Fix an issue in the vim-plugins-updater where it was trying to access the 'normalized_name' attribute on an HTTPResponse object, causing the updater to crash with: AttributeError: 'HTTPResponse' object has no attribute 'normalized_name' The fix adds type checking to ensure we only access normalized_name on Plugin objects, and properly handle other types like Exceptions and HTTPResponse objects. Signed-off-by: Austin Horstman --- maintainers/scripts/pluginupdate-py/pluginupdate.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/maintainers/scripts/pluginupdate-py/pluginupdate.py b/maintainers/scripts/pluginupdate-py/pluginupdate.py index 060f7015de23..e3a4c44ede7e 100644 --- a/maintainers/scripts/pluginupdate-py/pluginupdate.py +++ b/maintainers/scripts/pluginupdate-py/pluginupdate.py @@ -558,7 +558,16 @@ class Editor: } for plugin_desc, plugin, redirect in fetched: - result[plugin.normalized_name] = (plugin_desc, plugin, redirect) + # Check if plugin is a Plugin object and has normalized_name attribute + if isinstance(plugin, Plugin) and hasattr(plugin, 'normalized_name'): + result[plugin.normalized_name] = (plugin_desc, plugin, redirect) + elif isinstance(plugin, Exception): + # For exceptions, we can't determine the normalized_name + # Just log the error and continue + log.error(f"Error fetching plugin {plugin_desc.name}: {plugin!r}") + else: + # For unexpected types, log the issue + log.error(f"Unexpected plugin type for {plugin_desc.name}: {type(plugin)}") return list(result.values())