Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Fix URL encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
maakbaas committed Nov 15, 2022
1 parent 3efb0d7 commit 813418e
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 131 deletions.
2 changes: 1 addition & 1 deletion gui/js/comp/FileListing.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function FileListing(props) {
<a href={`${props.API}/download/${state.files[i]}`} rel="noreferrer" target="_blank" onClick={(e) => { e.stopPropagation();}}>
<Button title={loc.filesDl}><Download /></Button>
</a>
<Fetch href={`${props.API}/api/files/remove?filename=${state.files[i]}`} POST onFinished={fetchData}>
<Fetch href={`${props.API}/api/files/remove?filename=${encodeURIComponent(state.files[i])}`} POST onFinished={fetchData}>
<RedButton title={loc.filesRm} ><Trash2 /></RedButton>
</Fetch>
</div>
Expand Down
2 changes: 1 addition & 1 deletion gui/js/comp/FirmwarePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function FirmwarePage(props) {
</>;

function startFlashing() {
fetch(`${props.API}/api/update?filename=${filename}`, { method: "POST" })
fetch(`${props.API}/api/update?filename=${encodeURIComponent(filename)}`, { method: "POST" })
.then((response) => { return response.status; })
.then((status) => {
if (status == 200) {
Expand Down
4 changes: 2 additions & 2 deletions gui/js/comp/WifiPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export function WifiPage(props) {

function changeWifi() {
if (dhcpForm) {
fetch(`${props.API}/api/wifi/set?ssid=${escape(document.getElementById("ssid").value.trim())}&pass=${escape(document.getElementById("pass").value.trim())}`, { method: "POST" });
fetch(`${props.API}/api/wifi/set?ssid=${encodeURIComponent(document.getElementById("ssid").value.trim())}&pass=${encodeURIComponent(document.getElementById("pass").value.trim())}`, { method: "POST" });
} else {
fetch(`${props.API}/api/wifi/setStatic?ssid=${escape(document.getElementById("ssid").value.trim())}&pass=${escape(document.getElementById("pass").value.trim())}&ip=${escape(document.getElementById("ip").value.trim())}&sub=${escape(document.getElementById("sub").value.trim())}&gw=${escape(document.getElementById("gw").value.trim())}&dns=${escape(document.getElementById("dns").value.trim())}`, { method: "POST" });
fetch(`${props.API}/api/wifi/setStatic?ssid=${encodeURIComponent(document.getElementById("ssid").value.trim())}&pass=${encodeURIComponent(document.getElementById("pass").value.trim())}&ip=${encodeURIComponent(document.getElementById("ip").value.trim())}&sub=${encodeURIComponent(document.getElementById("sub").value.trim())}&gw=${encodeURIComponent(document.getElementById("gw").value.trim())}&dns=${encodeURIComponent(document.getElementById("dns").value.trim())}`, { method: "POST" });
document.getElementById("ip").value = "";
document.getElementById("gw").value = "";
document.getElementById("sub").value = "";
Expand Down
Loading

0 comments on commit 813418e

Please sign in to comment.