LP1862834: Use More Specific Regexes when Building URLs user/jboyer/lp1862834_regular_replacements
authorJason Boyer <JBoyer@equinoxOLI.org>
Sun, 5 Mar 2023 19:10:32 +0000 (14:10 -0500)
committerJason Boyer <JBoyer@equinoxOLI.org>
Sun, 5 Mar 2023 19:28:34 +0000 (14:28 -0500)
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 <JBoyer@equinoxOLI.org>
13 files changed:
Open-ILS/web/js/ui/default/staff/acq/app.js
Open-ILS/web/js/ui/default/staff/admin/acq/app.js
Open-ILS/web/js/ui/default/staff/admin/actor/app.js
Open-ILS/web/js/ui/default/staff/admin/local/app.js
Open-ILS/web/js/ui/default/staff/admin/local/permission/app.js
Open-ILS/web/js/ui/default/staff/admin/server/app.js
Open-ILS/web/js/ui/default/staff/admin/user_perms.js
Open-ILS/web/js/ui/default/staff/booking/app.js
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
Open-ILS/web/js/ui/default/staff/cat/item/app.js
Open-ILS/web/js/ui/default/staff/circ/patron/app.js
Open-ILS/web/js/ui/default/staff/circ/patron/holds.js
Open-ILS/web/js/ui/default/staff/circ/services/item.js

index 4be5753..1a6ea93 100644 (file)
@@ -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);
 
index 1d96be3..4ffc03f 100644 (file)
@@ -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);
 
index 859de55..822d51f 100644 (file)
@@ -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);
 
index 8758257..9d96380 100644 (file)
@@ -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);
 
index 185ad33..f826a88 100644 (file)
@@ -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);
 
index 979f177..8060990 100644 (file)
@@ -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);
 
index 54011a7..14ba34c 100644 (file)
@@ -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);
 
index 8b92d27..b31f250 100644 (file)
@@ -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);
 
index 3e82d65..e609ed7 100644 (file)
@@ -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':
index f722013..886946f 100644 (file)
@@ -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 = {};
index 0fc8841..566cec2 100644 (file)
@@ -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);
 
index 3173bfd..ffd7951 100644 (file)
@@ -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) {
     }
index bd509d7..83912e1 100644 (file)
@@ -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);
                     }]
                 });
             }