-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support compressed files that contain a SQL file in importer #363
Conversation
4cf434e
to
9e2bde0
Compare
9e2bde0
to
343eb45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fluiddot , The code looks good, but I'm not able to see the output of the submit button.
When I apply your patch and I run npm start, I see this error in the console:
<e> [ForkTsCheckerWebpackPlugin] ERROR in ./src/lib/import-export/import/importers/index.ts:1:15
<e> TS1261: Already included file name '/Users/macbookpro/Documents/projects/a8c/studio/src/lib/import-export/import/importers/importer.ts' differs from file name '/Users/macbookpro/Documents/projects/a8c/studio/src/lib/import-export/import/importers/Importer.ts' only in casing.
<e> The file is in the program because:
<e> Imported via './importer' from file '/Users/macbookpro/Documents/projects/a8c/studio/src/lib/import-export/import/importers/index.ts'
<e> Imported via './importers/importer' from file '/Users/macbookpro/Documents/projects/a8c/studio/src/lib/import-export/import/import-manager.ts'
<e> Imported via '../../import/importers/importer' from file '/Users/macbookpro/Documents/projects/a8c/studio/src/lib/import-export/tests/import/import-manager.test.ts'
<e> Root file specified for compilation
<e> > 1 | export * from './importer';
And here is the output.
WErVgS.mp4
Oh, let me take a look. Maybe something got broken when solving conflicts after rebasing |
@sejas I've updated the patch in the PR's description. I forgot that one of the files was renamed 😅. Let me know if now works. Thanks 🙇 ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fluiddot , thanks for providing an easy way to test the PR.
I confirm it works as expected.
https://github.com/user-attachments/assets/4eeeac09-4d7f-4c88-8d5e-aea4c8e5f6ea
@@ -8,6 +8,16 @@ export interface BackupHandler { | |||
extractFiles( file: BackupArchiveInfo, extractionDirectory: string ): Promise< void >; | |||
} | |||
|
|||
const EXCLUDED_FILES_PATTERNS = [ | |||
/^__MACOSX\/.*/, // MacOS meta folder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we exclude /^\.DS_Store$/
too ? Or is that already covered by /^\..*/, // Unix hidden files at root
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. As you pointed out, we don't need to explicitly exclude .DS_Store
as it will be covered by that pattern. In fact, the compressed files I added in backup-files.zip contain that hidden folder and are not being processed.
Related to 8282-gh-Automattic/dotcom-forge.
Proposed Changes
isFileAllowed
that is used in the different backup handlers to filter those files out. It's important to clean up the backup content when importing SQL-only files, otherwise, the following condition won't be met and the import will fail.listFiles
to cover the changes, plus fix the issue spotted here.studio/src/lib/import-export/import/validators/sql-validator.ts
Line 7 in caa31a0
Testing Instructions
STUDIO_IMPORT_EXPORT=true npm start
<TEMPORAL_FOLDER>/<PATH_TO_FILE>/wp_posts.sql
].Pre-merge Checklist