Bug report #890
python plugin installer unzip fails
|Affected QGIS version:||Regression?:||No|
|Operating System:||All||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||10949|
The plugin installer downloads python plugins as a zip file. The code in qgis_plugins.py fails to unzip correctly if the top-level folder entry is not included in the zip.
It is possible to make a zip file with no top-level folder entry by doing:
zip foo.zip ./foo/*
zip -r foo.zip ./foo
The code fails because it tries to create the directory hierarchy by looking for entries in the zip that end in '/'. If this isn't in the zip file then it then tries to extract a file to a non-existing directory, giving an error dialog that suggests (wrongly) it may be a permission problem.
Googling for python and unzip found the source of this code and some fixes in the comments.
There's a few 'try:except' clauses in the code that might be rewritten to return the exception so that a user gets more information when something fails.
Oh, and a line in installer_plugin.py that should maybe be:
plugindir = os.path.join(os.path.normpath(str(QgsApplication.qgisSettingsDirPath())), "python","plugins")
instead of concatenating path components.