Fix incorrect display of non-absolute paths

This commit is contained in:
David 2021-10-18 22:32:15 +01:00
parent eb6d519282
commit 616d6607e6
No known key found for this signature in database
GPG key ID: 913FE0F2477D7D6B

View file

@ -278,11 +278,13 @@ function show_custom_backup() {
$("#backup-target-type").val("off"); $("#backup-target-type").val("off");
} else if (r.target.substring(0, 8) == "rsync://") { } else if (r.target.substring(0, 8) == "rsync://") {
$("#backup-target-type").val("rsync"); $("#backup-target-type").val("rsync");
var path = r.target.substring(8).split('//'); let uri = r.target.substring(8)
var host_parts = path.shift().split('@'); let i = uri.indexOf("/")
let path = [uri.slice(0, i), uri.slice(i + 1)];
let host_parts = path.shift().split('@');
$("#backup-target-rsync-user").val(host_parts[0]); $("#backup-target-rsync-user").val(host_parts[0]);
$("#backup-target-rsync-host").val(host_parts[1]); $("#backup-target-rsync-host").val(host_parts[1]);
$("#backup-target-rsync-path").val('/'+path[0]); $("#backup-target-rsync-path").val(path[0]);
$("#backup-target-rsync-port").val(r.target_rsync_port) $("#backup-target-rsync-port").val(r.target_rsync_port)
} else if (r.target.substring(0, 5) == "s3://") { } else if (r.target.substring(0, 5) == "s3://") {
$("#backup-target-type").val("s3"); $("#backup-target-type").val("s3");