mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
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 <khaneliman12@gmail.com>
This commit is contained in:
parent
9831a2b6c3
commit
31bc320fd1
1 changed files with 10 additions and 1 deletions
|
@ -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())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue