Skip to content

Commit 0444f88

Browse files
authored
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
1 parent fcbdf73 commit 0444f88

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/lib/picker.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,17 @@ class PickerLoader {
787787
const validateRes = getValidator(PickerParamsSchema)(options);
788788

789789
if (validateRes.errors.length) {
790-
throw new FilestackError(`Invalid picker params`, validateRes.errors, FilestackErrorType.VALIDATION);
790+
validateRes.errors.forEach(error => {
791+
if (error.path.includes('fromSources')) {
792+
console.warn(`Warning: Invalid source \"${error.instance}\" found and removed!`);
793+
options.fromSources = options.fromSources.filter(source => source !== error.instance);
794+
} else {
795+
throw new FilestackError(`Invalid picker params`, validateRes.errors, FilestackErrorType.VALIDATION);
796+
}
797+
});
798+
if (!options.fromSources.length) {
799+
delete options.fromSources;
800+
}
791801
}
792802

793803
this._initialized = this.loadModule(client, options);

src/schema/picker.schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export const PickerParamsSchema = {
6868
'facebook',
6969
'instagram',
7070
'googledrive',
71+
'picasa',
7172
'unsplash',
7273
'dropbox',
7374
'webcam',

0 commit comments

Comments
 (0)