[wp-trac] [WordPress Trac] #12637: OS X-generated theme zips won't upload properly

WordPress Trac wp-trac at lists.automattic.com
Thu Mar 18 18:42:48 UTC 2010


#12637: OS X-generated theme zips won't upload properly
--------------------------+-------------------------------------------------
 Reporter:  chrisbliss18  |       Owner:  chrisbliss18           
     Type:  defect (bug)  |      Status:  new                    
 Priority:  normal        |   Milestone:  3.0                    
Component:  Themes        |     Version:  3.0                    
 Severity:  normal        |    Keywords:  has-patch tested commit
--------------------------+-------------------------------------------------
 The current trunk doesn't handle theme zip files generated on OS X very
 well. There are a couple of issues:

  * r13006 introduced the [http://www.php.net/manual/en/zip.constants.php
 ZIPARCHIVE::CHECKCONS] check for validating whether a zip file can be
 properly opened. All zip files generated using OS X by right-clicking a
 directory and selecting "Compress" fail this consistency check and result
 in an error message of "Incompatible Archive" being displayed. While
 checking for consistency is nice, this will cause more issues than it will
 prevent.
  * When the uploaded theme zip is being parsed, if more than one directory
 exists, a nested directory structure will be created for the theme. Since
 many methods of generating a zip file on OS X cause an additional
 {{{__MACOSX}}} directory, which is hidden in OS X, to be added to the root
 of the zip file, uploading one of these zip files causes unexpected
 behavior of nested directories and causes a number of errors to be
 displayed. These errors indicate some additional problems which would be
 best dealt with in a separate ticket.
    [[br]][[br]]
    For example, if a directory called sample-theme which contains theme
 files are zipped on OS X and uploaded via Add New Theme > Upload, the
 resulting directory structure would look like:
    * sample-theme/
    * sample-theme/sample-theme/
    * sample-theme/{{{__MACOSX}}}/

 Way to reproduce problem 1:

  * In OS X, right-click (or ctrl+click) a theme directory and select
 "Compress" to create a zip file. [http://new.gaarai.com/os-x-sample-
 theme.zip premade sample theme zip]
  * On a site running WP r13006 or above, go to Appearance > Add New
 Themes, click the Upload tab, select the zip file created above, and click
 "Install Now".

 Problem 1 result:
 [[Image(http://new.gaarai.com/os-x-theme-zip-failure-step-1-example.png,
 600)]]

 Way to reproduce problem 2:

  * In OS X, right-click (or ctrl+click) a theme directory and select
 "Compress" to create a zip file. [http://new.gaarai.com/os-x-sample-
 theme.zip premade sample theme zip]
  * On a site running 2.9.2 or trunk with the ZIPARCHIVE::CHECKCONS
 (represented as a number 4 on some builds) argument removed, go to
 Appearance > Add New Themes, click the Upload tab, select the zip file
 created above, and click "Install Now".

 Problem 2 result:
 [[Image(http://new.gaarai.com/os-x-theme-zip-failure-step-2-example.png,
 600)]]

 The supplied patch fixes both of these problems.

 Problem 1 is fixed by simply removing the ZIPARCHIVE::CHECKCONS argument
 for !ZipArchive->open() in wp-admin/includes/file.php.

 Problem 2 is fixed by adding checks in both the _unzip_file_ziparchive and
 _unzip_file_pclzip functions that prevent a root-level {{{__MACOSX}}}
 directory from being extracted with the rest of the files/directories.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12637>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list