From: Jason Boyer Date: Sun, 5 Mar 2023 19:10:32 +0000 (-0500) Subject: LP1862834: Use More Specific Regexes when Building URLs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fjboyer%2Flp1862834_regular_replacements;p=working%2FEvergreen.git LP1862834: Use More Specific Regexes when Building URLs If using regex to replace something in a pathname, make that explicit so we don't accidentally break things for hostnames starting with "eg" or "staff". Signed-off-by: Jason Boyer --- diff --git a/Open-ILS/web/js/ui/default/staff/acq/app.js b/Open-ILS/web/js/ui/default/staff/acq/app.js index 4be57531ff..1a6ea932c0 100644 --- a/Open-ILS/web/js/ui/default/staff/acq/app.js +++ b/Open-ILS/web/js/ui/default/staff/acq/app.js @@ -113,7 +113,7 @@ function($scope , $routeParams , $location , $window , $timeout , egCore , $uibM // embed URL must include protocol/domain or it will be loaded via // push-state, resulting in an infinitely nested pages. $scope.acq_url = - $location.absUrl().replace(/\/eg\/staff.*/, acq_path); + $location.absUrl().replace(/\/eg\/staff\/.*/, acq_path); console.log('Loading Acq URL: ' + $scope.acq_url); diff --git a/Open-ILS/web/js/ui/default/staff/admin/acq/app.js b/Open-ILS/web/js/ui/default/staff/admin/acq/app.js index 1d96be3561..4ffc03fa3f 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/acq/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/acq/app.js @@ -60,7 +60,7 @@ function($scope , $routeParams , $location , egCore) { // embed URL must include protocol/domain or it will be loaded via // push-state, resulting in an infinitely nested pages. $scope.acq_admin_url = - $location.absUrl().replace(/\/eg\/staff.*/, acq_path); + $location.absUrl().replace(/\/eg\/staff\/.*/, acq_path); console.log('Loading Admin Acq URL: ' + $scope.acq_admin_url); diff --git a/Open-ILS/web/js/ui/default/staff/admin/actor/app.js b/Open-ILS/web/js/ui/default/staff/admin/actor/app.js index 859de5509e..822d51fc97 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/actor/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/actor/app.js @@ -41,7 +41,7 @@ function($scope , $routeParams , $window , $location , egCore) { // have to use the full URL, not just the path, to ensure // the embeded page is not a nested version of this page (ad infinitum) $scope.address_alert_url = $location.absUrl().replace( - /\/eg\/staff.*/, '/eg/conify/global/actor/address_alert'); + /\/eg\/staff\/.*/, '/eg/conify/global/actor/address_alert'); console.log($scope.address_alert_url); diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/app.js b/Open-ILS/web/js/ui/default/staff/admin/local/app.js index 875825702c..9d96380310 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/local/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/local/app.js @@ -105,7 +105,7 @@ function($scope , $routeParams , $location , egCore) { // embed URL must include protocol/domain or it will be loaded via // push-state, resulting in an infinitely nested pages. $scope.local_admin_url = - $location.absUrl().replace(/\/eg\/staff.*/, conify_path); + $location.absUrl().replace(/\/eg\/staff\/.*/, conify_path); console.log('Loading local admin URL: ' + $scope.local_admin_url); diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/permission/app.js b/Open-ILS/web/js/ui/default/staff/admin/local/permission/app.js index 185ad33034..f826a88b5a 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/local/permission/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/local/permission/app.js @@ -460,7 +460,7 @@ function($scope , $routeParams , $location , egCore) { // embed URL must include protocol/domain or it will be loaded via // push-state, resulting in an infinitely nested pages. $scope.local_admin_url = - $location.absUrl().replace(/\/eg\/staff.*/, conify_path); + $location.absUrl().replace(/\/eg\/staff\/.*/, conify_path); console.log('Loading local admin URL: ' + $scope.local_admin_url); diff --git a/Open-ILS/web/js/ui/default/staff/admin/server/app.js b/Open-ILS/web/js/ui/default/staff/admin/server/app.js index 979f1777e5..8060990e79 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/server/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/server/app.js @@ -56,7 +56,7 @@ function($scope , $routeParams , $location , egCore) { // embed URL must include protocol/domain or it will be loaded via // push-state, resulting in an infinitely nested pages. $scope.server_admin_url = - $location.absUrl().replace(/\/eg\/staff.*/, conify_path); + $location.absUrl().replace(/\/eg\/staff\/.*/, conify_path); console.log('Loading server admin URL: ' + $scope.server_admin_url); @@ -75,7 +75,7 @@ function($scope , $routeParams , $location , egCore) { // embed URL must include protocol/domain or it will be loaded via // push-state, resulting in an infinitely nested pages. $scope.server_admin_url = - $location.absUrl().replace(/\/eg\/staff.*/, conify_path); + $location.absUrl().replace(/\/eg\/staff\/.*/, conify_path); console.log('Loading server admin URL: ' + $scope.server_admin_url); diff --git a/Open-ILS/web/js/ui/default/staff/admin/user_perms.js b/Open-ILS/web/js/ui/default/staff/admin/user_perms.js index 54011a7cca..14ba34cda1 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/user_perms.js +++ b/Open-ILS/web/js/ui/default/staff/admin/user_perms.js @@ -83,7 +83,7 @@ function($scope , $routeParams , $window , $location , egCore) { var user_id = $routeParams.user_id; var url = $location.absUrl().replace( - /\/eg\/staff.*/, '/xul/server/patron/user_edit.xhtml'); + /\/eg\/staff\/.*/, '/xul/server/patron/user_edit.xhtml'); url += '?usr=' + encodeURIComponent(user_id); diff --git a/Open-ILS/web/js/ui/default/staff/booking/app.js b/Open-ILS/web/js/ui/default/staff/booking/app.js index 8b92d2769a..b31f250832 100644 --- a/Open-ILS/web/js/ui/default/staff/booking/app.js +++ b/Open-ILS/web/js/ui/default/staff/booking/app.js @@ -38,7 +38,7 @@ function($scope , $routeParams , $location , egCore) { // embed URL must include protocol/domain or it will be loaded via // push-state, resulting in an infinitely nested pages. $scope.booking_url = - $location.absUrl().replace(/\/eg\/staff.*/, booking_path); + $location.absUrl().replace(/\/eg\/staff\/.*/, booking_path); console.log('Loading Booking URL: ' + $scope.booking_url); diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 3e82d65ef5..e609ed7cfb 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -944,7 +944,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e var booking_path = '/eg/conify/global/booking/resource'; $scope.booking_admin_url = - $location.absUrl().replace(/\/eg\/staff.*/, booking_path); + $location.absUrl().replace(/\/eg\/staff\/.*/, booking_path); }] }); } @@ -1997,7 +1997,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e // The URL is otherwise generated through user navigation. if ($scope.catalog_url) return; - var url = $location.absUrl().replace(/\/staff.*/, '/opac/advanced'); + var url = $location.absUrl().replace(/\/staff\/.*/, '/opac/advanced'); // A record ID in the path indicates a request for the record- // specific page. @@ -2039,7 +2039,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e $scope.parts_url = $location .absUrl() .replace( - /\/staff.*/, + /\/staff\/.*/, '/conify/global/biblio/monograph_part?r='+$scope.record_id ); } @@ -2100,7 +2100,7 @@ function($scope , $routeParams , $location , $window , $q , egCore) { .controller('URLVerifyCtrl', ['$scope','$location', function($scope , $location) { - $scope.verifyurls_url = $location.absUrl().replace(/\/staff.*/, '/url_verify/sessions'); + $scope.verifyurls_url = $location.absUrl().replace(/\/staff\/.*/, '/url_verify/sessions'); }]) .controller('VandelayCtrl', @@ -2138,13 +2138,13 @@ function($scope , $location, egCore, $uibModal) { .controller('ManageAuthoritiesCtrl', ['$scope','$location', function($scope , $location) { - $scope.manageauthorities_url = $location.absUrl().replace(/\/staff.*/, '/cat/authority/list'); + $scope.manageauthorities_url = $location.absUrl().replace(/\/staff\/.*/, '/cat/authority/list'); }]) .controller('BatchEditCtrl', ['$scope','$location','$routeParams', function($scope , $location , $routeParams) { - $scope.batchedit_url = $location.absUrl().replace(/\/eg.*/, '/opac/extras/merge_template'); + $scope.batchedit_url = $location.absUrl().replace(/\/eg\/.*/, '/opac/extras/merge_template'); if ($routeParams.container_type) { switch ($routeParams.container_type) { case 'bucket': diff --git a/Open-ILS/web/js/ui/default/staff/cat/item/app.js b/Open-ILS/web/js/ui/default/staff/cat/item/app.js index f7220130bd..886946f077 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/item/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/item/app.js @@ -1273,7 +1273,7 @@ console.debug($scope.copy_alert_count); break; case 'triggered_events': - var url = $location.absUrl().replace(/\/staff.*/, '/actor/user/event_log'); + var url = $location.absUrl().replace(/\/staff\/.*/, '/actor/user/event_log'); url += '?copy_id=' + encodeURIComponent(copyId); $scope.triggered_events_url = url; $scope.funcs = {}; diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 0fc8841643..566cec2e6e 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -1568,7 +1568,7 @@ function($scope , $location , egCore) { function($scope, $routeParams, $location , egCore , patronSvc) { $scope.initTab('other', $routeParams.id); - var url = $location.absUrl().replace(/\/staff.*/, '/actor/user/event_log'); + var url = $location.absUrl().replace(/\/staff\/.*/, '/actor/user/event_log'); url += '?patron_id=' + encodeURIComponent($routeParams.id); $scope.triggered_events_url = url; @@ -1581,7 +1581,7 @@ function($scope, $routeParams, $location , egCore , patronSvc) { $scope.initTab('other', $routeParams.id); var url = $location.protocol() + '://' + $location.host() - + egCore.env.basePath.replace(/\/staff.*/, '/actor/user/message'); + + egCore.env.basePath.replace(/\/staff\/.*/, '/actor/user/message'); url += '/' + encodeURIComponent($routeParams.id); $scope.message_center_url = url; @@ -1594,7 +1594,7 @@ function($scope , $routeParams , $window , $location , egCore) { $scope.initTab('other', $routeParams.id); var url = $location.absUrl().replace( - /\/eg\/staff.*/, '/xul/server/patron/user_edit.xhtml'); + /\/eg\/staff\/.*/, '/xul/server/patron/user_edit.xhtml'); url += '?usr=' + encodeURIComponent($routeParams.id); diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js b/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js index 3173bfdb70..ffd7951e1a 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js @@ -193,7 +193,7 @@ function($scope , $routeParams , $location , egCore , egWorkLog , patronSvc , $c }); $scope.catalog_url = - $location.absUrl().replace(/\/staff.*/, '/opac/advanced'); + $location.absUrl().replace(/\/staff\/.*/, '/opac/advanced'); $scope.handle_page = function(url) { } diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/item.js b/Open-ILS/web/js/ui/default/staff/circ/services/item.js index bd509d7ebb..83912e107a 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/item.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/item.js @@ -346,7 +346,7 @@ function(egCore , egOrg , egCirc , $uibModal , $q , $timeout , $window , ngToast var booking_path = '/eg/conify/global/booking/resource'; $scope.booking_admin_url = - $location.absUrl().replace(/\/eg\/staff.*/, booking_path); + $location.absUrl().replace(/\/eg\/staff\/.*/, booking_path); }] }); }