Folder renamed to download

Issue #29 resolved
Jack Slingerland
repo owner created an issue

Sometimes when a user updates their plugin/theme, the folder is renamed to "download".

""" I also saw another weird thing one time. I saw that de theme folder was renamed to download instead of the original theme name. Any idea why this happened. """

Comments (25)

  1. Connor Burton

    Just chiming in, haven't tried your service yet, however on my own integration of private theme updating I get the download-xxxx issue too, I have to manually rename the folder after the upgrade finishes. And it's consistent.

  2. Connor Burton

    I haven't found a true solution however I did find a few things:

    wp-admin/includes/class-wp-upgrader.php:470 you can rename the download-xxxx folder with that hook, I ended up doing that, as the rest of that method just copies the folder into the theme folders, you can also rename the folder once it's in the themes folder but I found that caused more issues.

    wp-admin/includes/class-wp-upgrader.php:673 this is where it grabs the remote .zip, but I never traced this back to where it generates the download-xxxx hash - this is probably the best bet for understanding why it does it.

    I've spent probably a good 4 days on this, I'm lost, nothing online, but it's good (in some way) to know other people are having this issue

  3. Jack Slingerland reporter

    Thanks for the gist and the info on your investigations. Is their anything special about your setup? PHP version, apache/nginx, language set to something non-english? So far the two people that have reported this problem have had their languages set to something non-english, but I tend to think that might just be coincidence.

  4. Connor Burton

    MAMP running 5.6.10, also tried running 7 and it still happened, running apache (will get versions in a couple of hours), set to English (UK). I will try grabbing a new installation of Wordpress and also try running it on a real server too.

    If running on a server or fresh installation doesn't help I can send over DB + files for you to try replicate if you like?

  5. Connor Burton

    Can confirm this happens on a production server too and grabbing a fresh WP installation doesn't help either. Can happily send over everything and to see if you can replicate it, I would be surprised if you can't. I'm starting to wonder if the issue because the .zip is the same name as the current theme's name. Will try that and see if it makes a difference

  6. Julien BODECHON

    I even tested with various Zip software! No track on this side! Ditto on different servers with different version of WP ... Nothing

    By cons, with the plugin W-Shadow.com I have the same problem ...

  7. Connor Burton

    Changed the zip name, still happens. Wondering if you need to specify something in the .json transient checks? Mine currently just has new_version, url and package

    I also traced back the download function to these couple of functions:

    wp-admin/includes/file.php:469 which downloads the file, but also wp-admin/includes/file.php:150 which gives the zip a temporary name, archive-xxxx.zip. This happens on any plugin/theme update, just open up wp-content/upgrade and watch that folder whilst you update one of the default themes, you will see for a split second it there with the -xxxxx appended.

    And then onto unpacking...

    wp-admin/includes/file.php:542 which doesn't do any removal of the -xxxx it just unzips the zip into the same folder. So the removal of that -xxxx must happen after the download and unpack.

    Will continue looking

  8. Jack Slingerland reporter

    @Connor Burton THANK YOU! You are seriously a boss. If you are ever in Raleigh I owe you a beer.

    On a side note, I changed the behavior of the CI functionality to force themes/plugins to be in folders a month ago, but it didn't cross my mind that it was affecting customers who manually upload new versions as well.

    Once again, THANK YOU!

  9. Connor Burton

    No problem, been trying to fix it for ages now so glad it's sorted

    Not sure I will ever just happen to be in Raleigh seems I live ~3700 miles away haha :) But I appreciate the THANK YOU's

  10. Log in to comment