Fix the remote source folder structure if necessary. #574
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Problem/Issue
Many developers including the owner of this repository are well aware of the folder structure issue. Mostly it happens to MacOs users. When compressing the plugin folder to make a zip archive in Mac, it makes the zip structure like this:-
But it used to throw an error because WP requires the structure to be like:-
that means
The update archive should contain a single directory that contains the rest of plugin/theme files.
Till today, the solution for mac users was to use a different archiver software. Issue reference: #210 #482 #456 #159 #382 #62
Using different archiver tool does solve the problem, but thats not the best solution. Because it should work regardless the user is on mac or windows. I should not take extra steps just because I am a mac user. A developer in mac encounters this error first, and has to visit this repository to search for a solution. Thats not really a good experience.
Moreover, we should not maintain two zip file sources (One for downloading and another for update). Because, the default plugin uploader page of WordPress allows both type of zip file structure to install the plugin. It doesn't require a specific structure. Currently the same zip that works for plugin uploading, doesn't work for plugin update. Thats really a problem.
What's done and what's the benefit?
After extracting the remote zip, It re-structures and corrects the folder/zip structure - if not correct already. Now regardless of the zip structure, both mac and windows zip update works. Mac users doesn't have to face this issue and search for solutions.
Let me know your thoughts and I am open to make any changes if necessary. Thanks for this awesome package.