0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Changed error when importing an LTS export

no issue

- importing an LTS export would cause Ghost to throw a 500 error because
  it used InternalServerError.
- an IncorrectUsageError is more applicable here
- this commit also updates the code comment and error message
- note: removed comment about WP exports because the plugin has been updated
  to support the v2 & v3 format
- spotted in Sentry
This commit is contained in:
Daniel Lockyer 2020-04-08 14:36:54 +01:00
parent b2fa6b9878
commit fe10d51536

View file

@ -64,14 +64,13 @@ DataImporter = {
});
}
// CASE: We deny LTS imports, because these are two major version jumps. We only support previous (v1) and latest (v2).
// CASE: We deny LTS imports, because these are major version jumps. Only imports from v1 until the latest are supported.
// We can detect a wrong structure by checking the meta version field. Ghost v0 doesn't use semver compliant versions.
// Same applies to WP exports. It currently uses the same meta version notation (000) - https://github.com/TryGhost/wp-ghost-exporter/issues/12
if (!semver.valid(importData.meta.version)) {
return Promise.reject(new common.errors.InternalServerError({
throw new common.errors.IncorrectUsageError({
message: 'Detected unsupported file structure.',
help: 'Please install Ghost 1.0, import the file and then update your blog to Ghost 2.0.\nVisit https://ghost.org/faq/upgrade-to-ghost-1-0 or ask for help in our https://forum.ghost.org.'
}));
help: 'Please install Ghost 1.0, import the file and then update your blog to the latest Ghost version.\nVisit https://ghost.org/update/?v=0.1 or ask for help in our https://forum.ghost.org.'
});
}
this.init(importData);