1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-25 18:40:26 +00:00

Fix: filename check in save dialogs #61

This commit is contained in:
jcorporation 2018-09-29 10:38:25 +02:00
parent 44dd0e2985
commit 17db5d7a2e

View File

@ -1648,7 +1648,7 @@ function addToPlaylist() {
var plist = plistEl.options[plistEl.selectedIndex].text; var plist = plistEl.options[plistEl.selectedIndex].text;
if (plist == 'New Playlist') { if (plist == 'New Playlist') {
var newPl = document.getElementById('addToPlaylistNewPlaylist').value; var newPl = document.getElementById('addToPlaylistNewPlaylist').value;
var valid = newPl.replace(/\w\-/g, ''); var valid = newPl.replace(/[\w\-]/g, '');
if (newPl != '' && valid == '') { if (newPl != '' && valid == '') {
plist = newPl; plist = newPl;
} else { } else {
@ -1696,7 +1696,7 @@ function showRenamePlaylist(from) {
function renamePlaylist() { function renamePlaylist() {
var from = document.getElementById('renamePlaylistFrom').value; var from = document.getElementById('renamePlaylistFrom').value;
var to = document.getElementById('renamePlaylistTo').value; var to = document.getElementById('renamePlaylistTo').value;
var valid = to.replace(/\w\-/g, ''); var valid = to.replace(/[\w\-]/g, '');
if (to != '' && to != from && valid == '') { if (to != '' && to != from && valid == '') {
sendAPI({"cmd": "MPD_API_PLAYLIST_RENAME", "data": {"from": from, "to": to}}); sendAPI({"cmd": "MPD_API_PLAYLIST_RENAME", "data": {"from": from, "to": to}});
modalRenamePlaylist.hide(); modalRenamePlaylist.hide();
@ -2046,12 +2046,13 @@ function gotoPage(x) {
function saveQueue() { function saveQueue() {
var plName = document.getElementById('saveQueueName').value; var plName = document.getElementById('saveQueueName').value;
var valid = plName.replace(/\w\-/g, ''); var valid = plName.replace(/[\w\-]/g, '');
if (plName != '' && valid == '') { if (plName != '' && valid == '') {
sendAPI({"cmd": "MPD_API_QUEUE_SAVE", "data": {"plist": plName}}); sendAPI({"cmd": "MPD_API_QUEUE_SAVE", "data": {"plist": plName}});
modalSavequeue.hide(); modalSavequeue.hide();
} }
else { else {
alert(valid);
document.getElementById('saveQueueName').classList.add('is-invalid'); document.getElementById('saveQueueName').classList.add('is-invalid');
document.getElementById('saveQueueFrm').classList.add('was-validated'); document.getElementById('saveQueueFrm').classList.add('was-validated');
} }