[wp-trac] [WordPress Trac] #30945: WP_Upgrader: Incorrect plugin folder after updating from remote (non-WP) URL

WordPress Trac noreply at wordpress.org
Thu Jan 8 03:33:43 UTC 2015


#30945: WP_Upgrader: Incorrect plugin folder after updating from remote (non-WP)
URL
-------------------------------+------------------------------
 Reporter:  miyarakira         |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Plugins            |     Version:  4.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by miyarakira):

 > The folder name in the ZIP is invalid, the files are stored as
 `../readme.txt` instead of `plugin-slug/readme.txt`, which you can check
 on the command line with `unzip -l file.zip`, so the `../` is being
 striped during decompression.

 Aah, I see. I didn't know a way to inspect the structure of the zip file,
 so was only seeing the result after decompression.

 During the plugin build, I'm using Gulp to zip everything and I'm limited
 as to the parameters I can pass to the zip process: the first format (no
 base folder) or second format specifying the base folder (`my-plugin/`).
 Apparently the latter is not working as I expected.  In both cases though,
 I can decompress them and the result is the same: all files in a base
 folder with the correct slug. So it would be helpful if WordPress could
 accommodate one or the other format.

 > Originally there's a reason why it respects the foldername in the zip
 archive, it was originally designed that if you'd installed a plugin in
 `plugins/some-fancy-plugin-slug`, but it was `plugin-slug` on
 WordPress.org, that it would remove `plugins/some-fancy-plugin-slug` and
 instead put it into `plugins/plugin-slug`.
 > Switching it to use the existing directory, when it's going to use a
 temporary folders filename during update seems like a valid solution
 though.

 That makes sense - it seems logical that before and after an update, the
 plugin should stay in the same folder. So perhaps a better patch would be
 to store the name of the original plugin directory, then when the
 temporary folder is being moved back, to restore its name?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30945#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list