From 5eb049779e9a98d4e2dcf23ab84eef46644b7784 Mon Sep 17 00:00:00 2001 From: Merlijn Vos Date: Mon, 16 Dec 2024 14:17:37 +0100 Subject: [PATCH] @uppy/core: bring back validateRestrictions (#5538) --- packages/@uppy/core/src/Uppy.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/@uppy/core/src/Uppy.ts b/packages/@uppy/core/src/Uppy.ts index 5e1ddaf455..ed9e6bd9e8 100644 --- a/packages/@uppy/core/src/Uppy.ts +++ b/packages/@uppy/core/src/Uppy.ts @@ -883,6 +883,18 @@ export class Uppy< } } + validateRestrictions( + file: ValidateableFile, + files: ValidateableFile[] = this.getFiles(), + ): RestrictionError | null { + try { + this.#restricter.validate(files, [file]) + } catch (err) { + return err as any + } + return null + } + validateSingleFile(file: ValidateableFile): string | null { try { this.#restricter.validateSingleFile(file)