Fix settings import validation
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user