Skip to content

Commit

Permalink
fix(REST): use encodeURIComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi committed Mar 11, 2022
1 parent 1c371aa commit c0855b1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Structures/REST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ export class REST {

public loadTracks(options: { source?: LavalinkSource; query: string } | string) {
if (typeof options === 'string') {
return this.get<LoadTrackResponse>(`loadtracks?identifier=${this.resolveIdentifier(LavalinkSourceEnum.Youtube)}:${options}`);
return this.get<LoadTrackResponse>(
`loadtracks?identifier=${encodeURIComponent(`${this.resolveIdentifier(LavalinkSourceEnum.Youtube)}:${options}`)}`
);
}
const source = options.source ?? LavalinkSourceEnum.Youtube;
const { query } = options;
return this.get<LoadTrackResponse>(
`loadtracks?identifier=${this.isUrl(options.query) ? query : `${this.resolveIdentifier(source)}:${query}`}`
`loadtracks?identifier=${
this.isUrl(options.query) ? encodeURIComponent(query) : `${encodeURIComponent(`${this.resolveIdentifier(source)}:${query}`)}`
}`
);
}

Expand Down

0 comments on commit c0855b1

Please sign in to comment.