Trailing spaces cause located URIs to be invalid

Bug #1722827 reported by Jane Sandberg on 2017-10-11
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Per Don Butterworth:

"if you unintentionally add a blank space after the text of a subfield 9 in the 856 field, Evergreen doesn't recognize the code as valid, and it will not display the 856 fields on the Record Summary screen and the title will not show up in the OPAC."

Rogan Hamby (rogan-hamby) wrote :

Hi Jane,

I was looking at this and the core issue is that a space at the beginning or end of a name could theoretically be a valid org unit name. I question why anyone would do that but .... there are more things in heaven and earth than dreamt of in my philosophies.

Still, if we want to trim surrounding spaces from it this should do it:;a=blobdiff;f=Open-ILS/src/sql/Pg/030.schema.metabib.sql;h=17b39fbcc380737d01c5f309d4bb2feb6b545589;hp=bc72c896017f793b21623132da28b20f0ec76d3f;hb=d9f0334c29b242f27bf8f6b85381595c7e2719c9;hpb=d6a247f3847fa26e8e5cadf8cd92ff573a828584


FWIW, I think this is worth doing, barring anyone pointing out use cases it would break and it worked in my (admittedly brief) testing.

Jane Sandberg (sandbej) wrote :

Thanks for the branch, Rogan! I think that we could add something to the documentation discouraging users from creating shortnames that have whitespace at the beginning or end.

I'll add the pullrequest tag to hopefully get some more eyes on this.

tags: added: pullrequest
Meg Stroup (mstroup) on 2018-05-21
Changed in evergreen:
assignee: nobody → Meg Stroup (mstroup)
assignee: Meg Stroup (mstroup) → nobody
Meg Stroup (mstroup) wrote :

Tested on master.

-I added a space at the end of a subfield $9, saved the record, and attempted it view it in the OPAC. None of the information from the 856 field displayed.

-I went into flat-text editor and added a space, then saved. Again, the 856 information did not display in the OPAC. I mention flat-text editor because it would be easier to add trailing space in flat-text without noticing you've done so.

-The records I altered by adding the trailing space did appear in OPAC searches.

Sylvia Orner (sorner) wrote :

I tested on Kathy's Sandbox with the same results. I even tried importing a record with a space in the $9, and the 856 information was not visible until the extra space was deleted.

Kathy Lussier (klussier) wrote :

Adding a note that both Meg and Sylvia were using the same Sandbox, and I have verified that the changes in the branch were made to the biblio.extract_located_uris function.

I have a quick question before I add the needsrepatch tag to this bug. On the records you tested, was there a 4 in the ind1 field and a 0 in the ind2 field? If I remember correctly, both are needed for the Located URI to work as expected.

Thanks for testing!

Mike Rylander (mrylander) wrote :

Just to add a data point, the xpath requirement for a located URI is:

  //*[@tag="856" and (@ind1="4" or @ind1="1") and (@ind2="0" or @ind2="1")]

So, ind1 must be either 4 or 1, and ind2 must be either 0 or 1.

Sylvia Orner (sorner) wrote :

All records that I tested had a first indicator of 4 and a second indicator of 0.

I'm not sure if something in the Sandbox changed between yesterday and today, but it appear that URIs are now appearing in records that I left trailing spaces in. I tested some additional records, and it seems to be working fine now.

Kathy Lussier (klussier) wrote :

Nothing on the Sandbox changed, but maybe it was a cache issue. Sylvia, would you be willing to add a signoff in the following manner:?

"I have tested this code and consent to signing off on it with my name, [enter name or consistent alias] and my email address, [enter email address]."


Kathy Lussier (klussier) wrote :

Actually, hold off on the signoff. I'm having trouble getting it to display too. I'll take a closer look.

Kathy Lussier (klussier) wrote :

I am seeing inconsistent behavior with this patch, and I haven't figured out a pattern yet on why it works sometimes, but not other times.

I created a record Wednesday with a space in the subfield 9, and the Located URI did not show. After editing the record a couple of times with different URIs (all with spaces), I was able to eventually get it to show.

Today, I tried again to see if I could find a pattern. However, no matter how many times I edit the record, I can't get the URL to show if there is a space in the subfield 9. Also, an entry isn't created in asset.call_number for this record.

The only time I could get the URL to appear (and an asset.call_number entry created) was when I entered the org unit in subfield 9 without any spaces.

tags: added: needsrepatch
removed: pullrequest
Rogan Hamby (rogan-hamby) wrote :

I'll take another look at it as well.

Rogan Hamby (rogan-hamby) wrote :

OK, did some testing tonight:

bib 248
master as of 8/14/18

add a single 856 ind1=4 ind2=0 single URL displays fine
add $9 for BR2
link disappears from unlogged in display
log into account set for BR2 as home ou, link appears
so, all normal as expected

add a space to the $9 at the end ... and it goes away
add the patch
add a space at the start and it rebuilds and works, new URI entry is created as expected and displays correctly

For those who whom it's working inconsistently, can you document your testing steps? I'd like to try to recreate the inconsistent behavior but aside from what I listed above I tried about ten other variations of spaces and it worked correctly for me.

Rogan Hamby (rogan-hamby) wrote :

OK, the issue is coming from the staff client. Sometimes (especially when there is a second space) a nonbreaking space chr(160) is getting encoded which is kind of rude of it.

New patch, again lightly tested but worked with a combination of regular and non-breaking spaces:;a=commit;h=fc598078a3dbfd981cd4fee293109408ce5b0653

tags: added: pullrequest
removed: needsrepatch
Meg Stroup (mstroup) wrote :

Tested rebuilt patch. Testing steps: added record for online resource. First, added org unit in $9 with no trailing spaces. Confirmed correct OPAC display. Added trailing space after $9 (after org unit name). Refreshed OPAC display is correct. Removed trailing space after $9 and added it before the org unit name. Refreshed OPAC display is correct.

I have tested this code and consent to signing off on it with my name, Meg Stroup, and my email address, <email address hidden>.

tags: added: signedoff
Changed in evergreen:
importance: Undecided → Low
status: New → Confirmed
Michele Morgan (mmorgan) on 2019-04-16
Changed in evergreen:
milestone: none → 3.3.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers