1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-07 18:30:54 +00:00

Merge pull request #1718 from pbiering/webui-adjustments

Webui adjustments
This commit is contained in:
Peter Bieringer 2025-02-27 08:52:24 +01:00 committed by GitHub
commit 3a4ec11733
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -874,8 +874,7 @@ function UploadCollectionScene(user, password, collection) {
upload_btn.onclick = upload_start; upload_btn.onclick = upload_start;
uploadfile_form.onchange = onfileschange; uploadfile_form.onchange = onfileschange;
let href = random_uuid(); href_form.value = "";
href_form.value = href;
/** @type {?number} */ let scene_index = null; /** @type {?number} */ let scene_index = null;
/** @type {?XMLHttpRequest} */ let upload_req = null; /** @type {?XMLHttpRequest} */ let upload_req = null;
@ -927,7 +926,7 @@ function UploadCollectionScene(user, password, collection) {
if(files.length > 1 || href.length == 0){ if(files.length > 1 || href.length == 0){
href = random_uuid(); href = random_uuid();
} }
let upload_href = collection.href + "/" + href + "/"; let upload_href = collection.href + href + "/";
upload_req = upload_collection(user, password, upload_href, file, function(result) { upload_req = upload_collection(user, password, upload_href, file, function(result) {
upload_req = null; upload_req = null;
results.push(result); results.push(result);
@ -993,10 +992,12 @@ function UploadCollectionScene(user, password, collection) {
hreflimitmsg_html.classList.remove("hidden"); hreflimitmsg_html.classList.remove("hidden");
href_form.classList.add("hidden"); href_form.classList.add("hidden");
href_label.classList.add("hidden"); href_label.classList.add("hidden");
href_form.value = random_uuid(); // dummy, will be replaced on upload
}else{ }else{
hreflimitmsg_html.classList.add("hidden"); hreflimitmsg_html.classList.add("hidden");
href_form.classList.remove("hidden"); href_form.classList.remove("hidden");
href_label.classList.remove("hidden"); href_label.classList.remove("hidden");
href_form.value = files[0].name.replace(/\.(ics|vcf)$/, '');
} }
return false; return false;
} }
@ -1213,7 +1214,7 @@ function CreateEditCollectionScene(user, password, collection) {
alert("You must enter a valid HREF"); alert("You must enter a valid HREF");
return false; return false;
} }
href = collection.href + "/" + newhreftxtvalue + "/"; href = collection.href + newhreftxtvalue + "/";
} }
displayname = displayname_form.value; displayname = displayname_form.value;
description = description_form.value; description = description_form.value;
@ -1348,8 +1349,10 @@ function cleanHREFinput(a) {
href_form = a.target; href_form = a.target;
} }
let currentTxtVal = href_form.value.trim().toLowerCase(); let currentTxtVal = href_form.value.trim().toLowerCase();
//Clean the HREF to remove non lowercase letters and dashes //Clean the HREF to remove not permitted chars
currentTxtVal = currentTxtVal.replace(/(?![0-9a-z\-\_])./g, ''); currentTxtVal = currentTxtVal.replace(/(?![0-9a-z\-\_\.])./g, '');
//Clean the HREF to remove leading . (would result in hidden directory)
currentTxtVal = currentTxtVal.replace(/^\./, '');
href_form.value = currentTxtVal; href_form.value = currentTxtVal;
} }