@uppy/core: bring back validateRestrictions (#5538)

This commit is contained in:
Merlijn Vos 2024-12-16 14:17:37 +01:00 committed by GitHub
parent 54ad2c7426
commit 5eb049779e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -883,6 +883,18 @@ export class Uppy<
}
}
validateRestrictions(
file: ValidateableFile<M, B>,
files: ValidateableFile<M, B>[] = this.getFiles(),
): RestrictionError<M, B> | null {
try {
this.#restricter.validate(files, [file])
} catch (err) {
return err as any
}
return null
}
validateSingleFile(file: ValidateableFile<M, B>): string | null {
try {
this.#restricter.validateSingleFile(file)