Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug that removes advanced target options when editing backups #4972

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,21 +457,32 @@ backupApp.service('AppUtils', function($rootScope, $timeout, $cookies, DialogSer

var URL_REGEXP_FIELDS = ['source_uri', 'backend-type', '--auth-username', '--auth-password', 'server-name', 'server-port', 'server-path', 'querystring'];
var URL_REGEXP = /([^:]+)\:\/\/(?:(?:([^\:]+)(?:\:?:([^@]*))?\@))?(?:([^\/\?\:]*)(?:\:(\d+))?)(?:\/([^\?]*))?(?:\?(.+))?/;
// Same as URL_REGEXP, but also accepts :\\ as a separator between drive letter (server for legacy reasons) and path
var FILE_REGEXP = /(file)\:\/\/(?:(?:([^\:]+)(?:\:?:([^@]*))?\@))?(?:([^\/\?\:]*)(?:\:(\d+))?)(?:(?:\/|\:\\)([^\?]*))?(?:\?(.+))?/;
var QUERY_REGEXP = /(?:^|&)([^&=]*)=?([^&]*)/g;

this.decode_uri = function(uri, backendlist) {

var i = URL_REGEXP_FIELDS.length + 1;
var i = 0;
var res = {};

var m = URL_REGEXP.exec(uri);
// File URLs contain backslashes on Win which breaks the other regexp
// This is not standard, but for compatibility it is allowed for now
var fileMatch = FILE_REGEXP.exec(uri);
if (fileMatch) {
for (i = 0; i < URL_REGEXP_FIELDS.length; ++i) {
res[URL_REGEXP_FIELDS[i]] = fileMatch[i] || "";
}
} else {
var m = URL_REGEXP.exec(uri);

// Invalid URI
if (!m)
return res;
// Invalid URI
if (!m)
return res;

while (i--) {
res[URL_REGEXP_FIELDS[i]] = m[i] || "";
for (i = 0; i < URL_REGEXP_FIELDS.length; ++i) {
res[URL_REGEXP_FIELDS[i]] = m[i] || "";
}
}

res.querystring.replace(QUERY_REGEXP, function(str, key, val) {
Expand All @@ -480,7 +491,7 @@ backupApp.service('AppUtils', function($rootScope, $timeout, $cookies, DialogSer
});

var backends = {};
for(var i in backendlist)
for(i in backendlist)
backends[backendlist[i].Key] = true;

var scheme = res['backend-type'];
Expand Down