From 085c128cfa07248410be37bf1f345a3d9ff6d25c Mon Sep 17 00:00:00 2001 From: brantje Date: Fri, 21 Oct 2016 12:39:03 +0200 Subject: [PATCH] Use port numbers Signed-off-by: brantje --- js/app/controllers/share.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js index 8d37aaf3..1915b3ff 100644 --- a/js/app/controllers/share.js +++ b/js/app/controllers/share.js @@ -134,7 +134,7 @@ }; if (enc_key) { var hash = window.btoa($scope.storedCredential.guid + '<::>' + enc_key); - $scope.share_link = $location.$$protocol + '://' + $location.$$host + OC.generateUrl('apps/passman/share/public#') + hash; + $scope.share_link = getShareLink(hash); } } else { var obj = { @@ -271,6 +271,13 @@ } }); + var getShareLink = function(hash){ + var port; + var defaultPort = ($location.$$protocol === 'http') ? 80 : 443; + port = (defaultPort !== $location.$$port) ? ':'+ $location.$$port : ''; + return $location.$$protocol + '://' + $location.$$host + port + OC.generateUrl('apps/passman/share/public#') + hash; + }; + $scope.sharing_complete = true; $scope.applyShare = function () { $scope.sharing_complete = false; @@ -295,7 +302,7 @@ }; ShareService.createPublicSharedCredential(shareObj).then(function () { var hash = window.btoa($scope.storedCredential.guid + '<::>' + enc_key); - $scope.share_link = $location.$$protocol + '://' + $location.$$host + OC.generateUrl('apps/passman/share/public#') + hash; + $scope.share_link = getShareLink(hash); }); } @@ -353,8 +360,7 @@ }; ShareService.createPublicSharedCredential(shareObj).then(function () { var hash = window.btoa($scope.storedCredential.guid + '<::>' + key); - $scope.share_link = $location.$$protocol + '://' + $location.$$host + OC.generateUrl('apps/passman/share/public#') + hash; - + $scope.share_link = getShareLink(hash); }); } @@ -382,4 +388,4 @@ return total; }; }]); -}()); \ No newline at end of file +}());