From 9c2ddfe746c57771d376daf482c293e784a4c68c Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Wed, 23 Sep 2015 10:47:01 +0200 Subject: [PATCH] Added common method to merge path and server for backends --- .../ngax/scripts/services/EditUriBuiltins.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js index 5cd4f1da2..535d74c07 100644 --- a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js +++ b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js @@ -1,5 +1,16 @@ backupApp.service('EditUriBuiltins', function(AppService, AppUtils, SystemInfo, EditUriBackendConfig, $http) { + EditUriBackendConfig.mergeServerAndPath = function(scope) { + if ((scope.Server || '') != '') { + var p = scope.Path; + scope.Path = scope.Server; + if ((p || '') != '') + scope.Path += '/' + p; + + delete scope.Server; + } + }; + // All backends with a custom UI must register here EditUriBackendConfig.templates['file'] = 'templates/backends/file.html'; EditUriBackendConfig.templates['s3'] = 'templates/backends/s3.html'; @@ -135,14 +146,7 @@ backupApp.service('EditUriBuiltins', function(AppService, AppUtils, SystemInfo, delete options['--authid']; - if ((scope.Server || '') != '') { - var p = scope.Path; - scope.Path = scope.Server; - if ((p || '') != '') - scope.Path += '/' + p; - - delete scope.Server; - } + EditUriBackendConfig.mergeServerAndPath(scope); }; EditUriBackendConfig.parsers['googledrive'] = function() { return this['oauth-base'].apply(this, arguments); },