Studio: Handle duplicate SQL files in tar.gz archives - #793
Merged
ivan-ottinger merged 2 commits intoJan 9, 2025
Conversation
listFiles does not include any file path duplicates
fredrikekelund
approved these changes
Jan 9, 2025
fredrikekelund
left a comment
Contributor
There was a problem hiding this comment.
Nice catch! LGTM and works as expected with the tarball you provided 👍
ivan-ottinger
deleted the
fix/duplicate-file-paths-generated-in-listfiles
branch
January 9, 2025 13:29
wojtekn
reviewed
Jan 9, 2025
| export class BackupHandlerTarGz extends EventEmitter implements BackupHandler { | ||
| async listFiles( backup: BackupArchiveInfo ): Promise< string[] > { | ||
| const files: string[] = []; | ||
| const filesSet = new Set< string >(); |
Contributor
There was a problem hiding this comment.
A nice use of the built-in Set object to ensure entries are unique!
Contributor
Author
There was a problem hiding this comment.
Thank you, Wojtek! 🙂
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related issues
Proposed Changes
When importing
tar.gzarchives that contain duplicate SQL files, we will now ensure each file is processed only once by using a Set for deduplication. During extraction, tar's natural behavior will use the last occurrence of each file.Details can be found in the following comment: https://github.com/Automattic/dotcom-forge/issues/9029#issuecomment-2578098289.
listFilesdoes not include any file path duplicatesTesting Instructions
Pre-merge Checklist