diff options
Diffstat (limited to 'desktop/Sonix.qml')
| -rw-r--r-- | desktop/Sonix.qml | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/desktop/Sonix.qml b/desktop/Sonix.qml index d279dc6..46a5c61 100644 --- a/desktop/Sonix.qml +++ b/desktop/Sonix.qml @@ -7,6 +7,7 @@ // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. pragma Singleton @@ -62,7 +63,7 @@ Singleton { onExited: code => { console.warn("sonix: beacon relay exited", code); respawn.restart(); } } Timer { id: respawn; interval: 5000; onTriggered: { beacon.running = false; beacon.running = true; } } - Timer { id: lost; interval: 6000; onTriggered: { root.present = false; console.log("sonix: gone"); } } + Timer { id: lost; interval: 6000; onTriggered: { root.present = false; root.player = ({}); root.error = ""; console.log("sonix: gone"); } } Timer { interval: 1000 @@ -124,8 +125,10 @@ Singleton { h=$1 f=$2 d=$3 curl -s -m 3 -o /dev/null "http://$h/" || exit 3 curl -s -m 10 -o /dev/null --data-urlencode "path=$d" "http://$h/create" - code=$(curl -s -m 120 -o /dev/null -w '%{http_code}' --form-string "path=$d/" -F "files[]=@\"$f\"" "http://$h/upload") \ - || { echo "curl failed"; exit 1; } + err=$(mktemp) || exit 1 + code=$(curl -sS -m 120 -o /dev/null -w '%{http_code}' --form-string "path=$d/" -F "files[]=@\"$f\"" "http://$h/upload" 2>"$err") \ + || { cat "$err"; rm -f "$err"; exit 1; } + rm -f "$err" [ "$code" = 200 ] || { echo "HTTP $code"; exit 1; } ` Process { @@ -143,6 +146,7 @@ Singleton { } } function upload(file, cardDir, cb) { + if (/["\\]/.test(file)) { cb(1, "the output folder name contains \" or \\"); return; } if (up.running) { cb(1, "an upload is already running"); return; } up.cb = cb; up.code = -1; |
