Skip to content

Commit

Permalink
Added back picasa as a potential source (#567)
Browse files Browse the repository at this point in the history
* Added back picasa as a potential source

* Invalid values in fromSources only trigger a warning if they are not valid instead of an error
  • Loading branch information
RatGabi committed Jul 3, 2024
1 parent fcbdf73 commit 0444f88
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lib/picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/schema/picker.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const PickerParamsSchema = {
'facebook',
'instagram',
'googledrive',
'picasa',
'unsplash',
'dropbox',
'webcam',
Expand Down

0 comments on commit 0444f88

Please sign in to comment.