Record Buckets - Batch Edit redirect - Regex replace that fails for us

Bug #1862694 reported by Josh Stompro on 2020-02-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

EG 3.3.4

Our hostname contains a prefix of eg, so the code for batch editing records from a bucket fails for us, since it does a regex replace using /\/eg.*/ to create the new URL. So we cannot load the batch edit interface.

gets turned into

Code at;a=blob;f=Open-ILS/web/js/ui/default/staff/cat/catalog/app.js;hb=851572686b9d3c827bca282449d66299cc929e2e#l2079

$scope.batchedit_url = $location.absUrl().replace(/\/eg.*/, '/opac/extras/merge_template');


I found one other instance that could cause problems, if anyone has a hostname starting with staff.;a=blob;f=Open-ILS/web/js/ui/default/staff/cat/item/app.js;hb=HEAD#l1145

var url = $location.absUrl().replace(/\/staff.*/, '/actor/user/event_log');

That would match

I think it both cases the regex just needs to include the trailing forward slash so it cannot match the beginning of the hostname.

Unless "$scope.batchedit_url = $location.absUrl().replace(/\/eg.*/, '/opac/extras/merge_template');" is supposed to match /eg2/ or /eg/ ?


Is there a reason that the new URL can't be created by something like this instead to avoid a regex and related issues?

$scope.batchedit_url = $location.protocol()+'://'+$'/opac/extras/merge_template';


Here is a working branch that fixes the issue that is causing us trouble (all our evergreen servers use the prefix eg in the hostname, so I can replicate this in testing and production.


To test this bug, you need a system with a hostname that starts with "eg" to trigger the original issue.

1. Open up record buckets.
2. Pick a bucket that has some records.
3. select a few of them and choose batch edit.
4. the new batch edit tab should open and the iframe will give an error about not being able to load.

After the fix is applied, the iframe will load the batch edit interface.

Even without changing your servers hostname, you can test that the batch edit still works for you after the fix is applied.

I think there are a bunch of instances of the regex being set to match /\/staff.*/*%2F
but I want to keep this bug report specific to the one that is causing us issues to make it easier to test.

We are using this change in production now, I'll report back if there are any problems.


tags: added: pullrequest
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers