diff --git a/src/renderer/lib/image-providers/retrogaming.cloud.ts b/src/renderer/lib/image-providers/retrogaming.cloud.ts index 0b5615d648..cefa17d97a 100644 --- a/src/renderer/lib/image-providers/retrogaming.cloud.ts +++ b/src/renderer/lib/image-providers/retrogaming.cloud.ts @@ -1,10 +1,20 @@ import { GenericImageProvider, ImageContent, ProviderEvent, AppSettings } from "../../models"; import { LoggerService, SettingsService } from "../../services"; -import { Http, Headers, URLSearchParams, Response } from '@angular/http'; +import { Http, Headers, URLSearchParams, Response, QueryEncoder } from '@angular/http'; import { Observable } from "rxjs"; import { queue } from 'async'; import { FuzzyMatcher } from "../fuzzy-matcher"; +class CustomUrlEncoder extends QueryEncoder { + encodeKey(key: string): string { + return encodeURIComponent(key); + } + + encodeValue(value: string): string { + return encodeURIComponent(value); + } +} + export class RetroGamingCloudProvider implements GenericImageProvider { private timeoutQueue: AsyncQueue<{ timeout: number, eventCallback: () => void }>; private timeoutTimer: any; @@ -110,7 +120,7 @@ export class RetroGamingCloudProvider implements GenericImageProvider { } private retrieveImageList(title: string, eventCallback: (event: ProviderEvent, data: any) => void) { - let params = new URLSearchParams(); + let params = new URLSearchParams('', new CustomUrlEncoder()); params.append('name', title); return new Promise((resolve, reject) => { diff --git a/src/renderer/lib/image-providers/steamgriddb.ts b/src/renderer/lib/image-providers/steamgriddb.ts index a5db595682..91f375c6e8 100644 --- a/src/renderer/lib/image-providers/steamgriddb.ts +++ b/src/renderer/lib/image-providers/steamgriddb.ts @@ -1,8 +1,18 @@ import { GenericImageProvider, ImageContent, ProviderEvent } from "../../models"; import { LoggerService, SettingsService } from "../../services"; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Http, Headers, URLSearchParams, QueryEncoder } from '@angular/http'; import { Observable } from "rxjs"; +class CustomUrlEncoder extends QueryEncoder { + encodeKey(key: string): string { + return encodeURIComponent(key); + } + + encodeValue(value: string): string { + return encodeURIComponent(value); + } +} + export class SteamGridDbProvider implements GenericImageProvider { constructor(private http: Http, private loggerService: LoggerService, private settingsService: SettingsService, private downloadInterrupt: Observable, private timeout: number = 40000, private retryCount: number = 3) { } @@ -11,7 +21,7 @@ export class SteamGridDbProvider implements GenericImageProvider { } retrieveUrls(title: string, eventCallback: (event: ProviderEvent, data: any) => void, doneCallback: (title: string) => void) { - let params = new URLSearchParams(); + let params = new URLSearchParams('', new CustomUrlEncoder()); params.append('game', title); params.append('fields', ['author', 'grid_url'].toString());