Skip to content

Commit c7453ad

Browse files
authored
Fix search with Polish character (#3808)
1 parent 310a2a5 commit c7453ad

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

resources/js/services/search-service.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,17 @@ const SearchService = {
2020

2121
search(album_id: string | undefined, terms: string, page: number = 1): Promise<AxiosResponse<App.Http.Resources.Search.ResultsResource>> {
2222
return axios.get(`${Constants.getApiUrl()}Search`, {
23-
params: { album_id: this.albumId(album_id), terms: btoa(terms), page: page },
23+
params: { album_id: this.albumId(album_id), terms: base64encode(terms), page: page },
2424
data: {},
2525
});
2626
},
2727
};
2828

29+
function base64encode(str: string): string {
30+
const bytes = new TextEncoder().encode(str);
31+
let binary = "";
32+
bytes.forEach((b) => (binary += String.fromCharCode(b)));
33+
return btoa(binary);
34+
}
35+
2936
export default SearchService;

0 commit comments

Comments
 (0)