[Fix] Zip spec compliance for exported backup file #2157
Merged
+2
−1
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.
Motivation for the change, related issues
Files in a zip file should only have relative urls as per spec. Right now, when exporting the backup for the site, we create a zip file with a leading slash in the files inside it.
This got surfaced in Studio app when we switched to a diff zip library that strictly adheres to zip spec and PG exported zip files fail to process.
Related to: https://github.com/Automattic/dotcom-forge/issues/10369
Note: There are other places where
ZipArchive
is used but this PR only modifies the location that impacts the site export.Probably other places can use the same change, and I can follow that up in a separate PR, if you like.
Testing Instructions (or ideally a Blueprint)
Export zip of a site and examine the file paths inside it using the following script:
Prior to this PR, you would see file paths like:
and with this PR you will see file paths without the leading slash: