fix(import): don't fail when importing from dev exports
This commit is contained in:
parent
2c0c3ea24e
commit
ce3a06f03b
@ -30,6 +30,7 @@ import (
|
||||
"code.vikunja.io/api/pkg/models"
|
||||
"code.vikunja.io/api/pkg/modules/migration"
|
||||
"code.vikunja.io/api/pkg/user"
|
||||
vversion "code.vikunja.io/api/pkg/version"
|
||||
|
||||
"github.com/hashicorp/go-version"
|
||||
)
|
||||
@ -119,6 +120,10 @@ func (v *FileMigrator) Migrate(user *user.User, file io.ReaderAt, size int64) er
|
||||
return fmt.Errorf("could not read version file: %w", err)
|
||||
}
|
||||
|
||||
versionString := bufVersion.String()
|
||||
if versionString == "dev" && versionString == vversion.Version {
|
||||
log.Debugf(logPrefix + "Importing from dev version")
|
||||
} else {
|
||||
dumpedVersion, err := version.NewVersion(bufVersion.String())
|
||||
if err != nil {
|
||||
return err
|
||||
@ -131,6 +136,7 @@ func (v *FileMigrator) Migrate(user *user.User, file io.ReaderAt, size int64) er
|
||||
if dumpedVersion.LessThan(minVersion) {
|
||||
return fmt.Errorf("export was created with an older version, need at least %s but the export needs at least %s", dumpedVersion, minVersion)
|
||||
}
|
||||
}
|
||||
|
||||
//////
|
||||
// Import the bulk of Vikunja data
|
||||
|
Loading…
x
Reference in New Issue
Block a user