Skip to content

Commit 98e96b1

Browse files
committed
Added a fix for api's with spaces in their names
1 parent e09737a commit 98e96b1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/api/APIModel.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ export abstract class APIModel {
1919
abstract getById(id: string): Promise<MediaTypeModel>;
2020

2121
hasType(type: MediaType): boolean {
22-
const disabledMediaTypes = this.plugin.settings[`${this.apiName}_disabledMediaTypes` as keyof typeof this.plugin.settings] as MediaType[];
23-
return this.types.includes(type) && !disabledMediaTypes.includes(type);
22+
const sanitizedApiName = this.apiName.replace(/\s+/g, '_');
23+
const disabledMediaTypes = (this.plugin.settings[`${sanitizedApiName}_disabledMediaTypes` as keyof typeof this.plugin.settings] as MediaType[]) || [];
24+
return (this.types || []).includes(type) && !disabledMediaTypes.includes(type);
2425
}
2526

2627
hasTypeOverlap(types: MediaType[]): boolean {

0 commit comments

Comments
 (0)