diff --git a/docs/content/doc/usage/errors.md b/docs/content/doc/usage/errors.md index e0c05faa0..b33b550a0 100644 --- a/docs/content/doc/usage/errors.md +++ b/docs/content/doc/usage/errors.md @@ -90,6 +90,7 @@ This document describes the different errors Vikunja can return. | 4019 | 400 | Invalid task filter value. | | 4020 | 400 | The provided attachment does not belong to that task. | | 4021 | 400 | This user is already assigned to that task. | +| 4022 | 400 | The task has a relative reminder which does not specify relative to what. | ## Namespace diff --git a/pkg/models/error.go b/pkg/models/error.go index 694ef0f3a..69b63cedd 100644 --- a/pkg/models/error.go +++ b/pkg/models/error.go @@ -898,7 +898,7 @@ func (err ErrReminderRelativeToMissing) HTTPError() web.HTTPError { return web.HTTPError{ HTTPCode: http.StatusBadRequest, Code: ErrCodeReminderRelativeToMissing, - Message: "Relative reminder without relative_to", + Message: "Please provide what the reminder date is relative to", } } diff --git a/pkg/modules/migration/vikunja-file/vikunja.go b/pkg/modules/migration/vikunja-file/vikunja.go index 3e4c6011d..851b9e74a 100644 --- a/pkg/modules/migration/vikunja-file/vikunja.go +++ b/pkg/modules/migration/vikunja-file/vikunja.go @@ -141,7 +141,12 @@ func (v *FileMigrator) Migrate(user *user.User, file io.ReaderAt, size int64) er comment.ID = 0 } for _, attachment := range t.Attachments { - af, err := storedFiles[attachment.File.ID].Open() + attachmentFile, exists := storedFiles[attachment.File.ID] + if !exists { + log.Debugf(logPrefix+"Could not find attachment file %d for attachment %d", attachment.File.ID, attachment.ID) + continue + } + af, err := attachmentFile.Open() if err != nil { return fmt.Errorf("could not open attachment %d for reading: %w", attachment.ID, err) }