Skip to content

Commit

Permalink
feat: fix uri encoding of query parameters (#11)
Browse files Browse the repository at this point in the history
- fixes rom/save uri encoding when special characters are present

Co-authored-by: Nick VanCise <nickvancise@MacBook-Pro.local>
  • Loading branch information
thenick775 and Nick VanCise committed May 29, 2023
1 parent 7d90c49 commit e9789ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gbajs3/resources/gba-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function loadRomFromServer(query_select_rom) {
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', serverloc + '/api/rom/download?rom=' + query_select_rom);
xhr.open('GET', serverloc + '/api/rom/download?rom=' + encodeURIComponent(query_select_rom));
xhr.setRequestHeader('Authorization', 'Bearer ' + accesstoken);
xhr.responseType = 'blob';

Expand All @@ -128,7 +128,7 @@ function loadSaveFromServer(query_select_save) {
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', serverloc + '/api/save/download?save=' + query_select_save);
xhr.open('GET', serverloc + '/api/save/download?save=' + encodeURIComponent(query_select_save));
xhr.setRequestHeader('Authorization', 'Bearer ' + accesstoken);
xhr.responseType = 'blob';

Expand Down

0 comments on commit e9789ca

Please sign in to comment.