Fix settings import validation

This commit is contained in:
Daniel 2023-10-20 10:20:12 +02:00
parent 489c21ab5a
commit 8cb44bb11d
2 changed files with 2 additions and 2 deletions

View file

@ -263,7 +263,7 @@ func ImportSettings(r *SettingsImportRequest) (*ImportResult, error) {
} }
if checked < len(settings) { if checked < len(settings) {
result.ContainsUnknown = true result.ContainsUnknown = true
if !r.AllowUnknown { if !r.AllowUnknown && !r.ValidateOnly {
return nil, fmt.Errorf("%w: the export contains unknown settings", ErrInvalidImportRequest) return nil, fmt.Errorf("%w: the export contains unknown settings", ErrInvalidImportRequest)
} }
} }

View file

@ -140,7 +140,7 @@ func parseExport(request *ImportRequest, export any) error {
default: default:
// Checksums not supported. // Checksums not supported.
} }
if err != nil && errors.Is(err, filesig.ErrChecksumMissing) { if err != nil && !errors.Is(err, filesig.ErrChecksumMissing) {
return fmt.Errorf("failed to verify checksum: %w", err) return fmt.Errorf("failed to verify checksum: %w", err)
} }