From 0444f8889f3a808198dd7c774ac673911e36f30f Mon Sep 17 00:00:00 2001 From: GR Date: Wed, 3 Jul 2024 12:13:49 +0200 Subject: [PATCH] Added back picasa as a potential source (#567) * Added back picasa as a potential source * Invalid values in fromSources only trigger a warning if they are not valid instead of an error --- src/lib/picker.ts | 12 +++++++++++- src/schema/picker.schema.ts | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/picker.ts b/src/lib/picker.ts index 1c2bd962..a0afd1bb 100644 --- a/src/lib/picker.ts +++ b/src/lib/picker.ts @@ -787,7 +787,17 @@ class PickerLoader { const validateRes = getValidator(PickerParamsSchema)(options); if (validateRes.errors.length) { - throw new FilestackError(`Invalid picker params`, validateRes.errors, FilestackErrorType.VALIDATION); + validateRes.errors.forEach(error => { + if (error.path.includes('fromSources')) { + console.warn(`Warning: Invalid source \"${error.instance}\" found and removed!`); + options.fromSources = options.fromSources.filter(source => source !== error.instance); + } else { + throw new FilestackError(`Invalid picker params`, validateRes.errors, FilestackErrorType.VALIDATION); + } + }); + if (!options.fromSources.length) { + delete options.fromSources; + } } this._initialized = this.loadModule(client, options); diff --git a/src/schema/picker.schema.ts b/src/schema/picker.schema.ts index d7a1a44e..6b8355cc 100644 --- a/src/schema/picker.schema.ts +++ b/src/schema/picker.schema.ts @@ -68,6 +68,7 @@ export const PickerParamsSchema = { 'facebook', 'instagram', 'googledrive', + 'picasa', 'unsplash', 'dropbox', 'webcam',