Skip to content

Conversation

@Priyanshu-Singh-veer
Copy link

Fix: #15616

What does it do?

path.relative() method is converting filePath = schemas\\schemas_00001.jsonl from schemas/schemas_00001.jsonl so split method was unable to find / that's why parts = [ 'schemas\\schemas_00001.jsonl' ] instead of ['schemas', 'schemas_00001.jsonl']. Now split method splits filepath with \\ which is returned by path.relative().

Why is it needed?

On npm run strapi import we are getting error error: [FATAL] Invalid schema changes detected during integrity checks (using the strict strategy) because of sourceProvider.getSchema is getting no entry from tar parse() beacuse of its filter.

How to test it?

you can test it on windows by npm run strapi import this should successfully import all and sourceProvider.getSchema is getting schema from export file

Related issue(s)/PR(s)

no related PRs and READY TO MERGE

@strapi-cla
Copy link

strapi-cla commented Mar 5, 2023

CLA assistant check
All committers have signed the CLA.

@Priyanshu-Singh-veer Priyanshu-Singh-veer changed the title fixed: strapi/data-transfer/sourceProvider fixed: data-transfer import [Invalid schema changes detected during integrity checks] Mar 5, 2023
@strapi-bot
Copy link

This pull request has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/data-import-fatal-error-on-4-6-0/25285/10

@Marc-Roig Marc-Roig requested a review from Convly March 6, 2023 10:37
@Marc-Roig Marc-Roig added issue: bug Issue reporting a bug source: core:data-transfer Source is core/data-transfer package labels Mar 6, 2023
Copy link
Member

@Convly Convly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for your contribution.

Using backslashes instead of / will only fix the issue on Windows, we need to find a way to make it work both on Unix and windows systems.

Ideally, I would say we can use path.sep, but I'm kinda worried about what will happen if the archive has been created on one OS (win) and is read from a different one (Unix).

}

const parts = path.relative('.', filePath).split('/');
const parts = path.relative('.', filePath).split('\\');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this will break the feature on all OS except Windows. We might want to look into another solution here 👀

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as you said i also think path.sep will work for both kind of os.......can you elaborate more about archive issue by a scenario ?

@alexandrebodin alexandrebodin requested a review from Convly March 22, 2023 14:28
Copy link
Member

@Convly Convly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!
I have one doubt in mind: what happens if you make an export on an unix system on then try to import this backup on a windows machine? Are the paths resolved dynamically? Or are they stored directly in the archive signature? (honestly have no idea there)

@codecov
Copy link

codecov bot commented Mar 28, 2023

Codecov Report

Patch coverage has no change and project coverage change: -9.11 ⚠️

Comparison is base (b9e92de) 60.68% compared to head (40ec74f) 51.58%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15996      +/-   ##
==========================================
- Coverage   60.68%   51.58%   -9.11%     
==========================================
  Files        1495      374    -1121     
  Lines       36878    14078   -22800     
  Branches     7359     3165    -4194     
==========================================
- Hits        22380     7262   -15118     
+ Misses      12417     5615    -6802     
+ Partials     2081     1201     -880     
Flag Coverage Δ
back 51.32% <0.00%> (-0.02%) ⬇️
front ?
unit_back 51.32% <0.00%> (-0.02%) ⬇️
unit_front ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...e/data-transfer/src/file/providers/source/index.ts 33.96% <0.00%> (ø)

... and 1122 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@fperreaultnv
Copy link

Even if there is a remaining bug, (exporting from one platform and importing in another), this fix can still be merged, because it is very simple and will unblock many. Meanwhile another issue can be created with I believe much lower priority.

@anacicconi
Copy link

Hi, why is this issue closed? Is there a current solution to export from Linux to Windows and vice versa? It seems that the patch mentioned here will only work for files generated on Linux and imported to Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

issue: bug Issue reporting a bug source: core:data-transfer Source is core/data-transfer package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fatal error on import: Invalid schema changes detected during integrity checks

7 participants