Skip to content

Commit

Permalink
validate online image queries correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
cbartondock committed Oct 22, 2024
1 parent 24bf20b commit 5306f55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/renderer/components/parsers.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ export class ParsersComponent implements AfterViewInit, OnDestroy {
onlineImageQueries: new NestedFormElement.Bubble({
label: this.lang.label.onlineImageQueries,
highlight: this.highlight.bind(this),
addable: true,
onValidate: (self, path) =>
this.parsersService.validate(
path[0] as keyof UserConfiguration,
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/services/parsers.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,13 @@ export class ParsersService {
data ? data.limitToGroups || "" : "",
);
case "onlineImageQueries":
return data.map((x: string)=>this.validateVariableParserString(x)==null).reduce((x: boolean,y:boolean)=> x && y) ? null : "one of them bad";
if(!data) return null;
for(let query of data){
let err= this.validateVariableParserString(query)
if(!err) {continue}
else { return `${err}\\\nBad query: \`${query}\``}
}
return null
case "executableArgs":
return this.validateVariableParserString(data || "");
case "imagePool":
Expand Down

0 comments on commit 5306f55

Please sign in to comment.