openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

curly quotes break search and image upload

Open JeffKaplan opened this issue 9 years ago • 6 comments

examples: A Girl After God’s Own Heart vs A Girl After God’s Own Heart also breaks upload an image with curly quote in the filename.

JeffKaplan avatar Nov 08 '17 19:11 JeffKaplan

Stripping the curly quote entirely from the search string: https://openlibrary.org/search?q=A+Girl+After+Gods+Own+Heart&mode=everything finds the same 8 results as with the straight quote: https://openlibrary.org/search?q=A Girl After God's Own Heart&mode=everything

I see that Chrome urlencodes the straight quote to %27 https://openlibrary.org/search?q=A+Girl+After+God%27s+Own+Heart&mode=everything and the curly quote to https://openlibrary.org/search?https://openlibrary.org/search?q=A+Girl+After+God%E2%80%99s+Own+Heart&mode=everything but in the search bar it displays that as the curly quote, not the encoded equivalent.

It seems like it would be simplest to strip all punctuation from the search string for consistency.

LeadSongDog avatar Nov 09 '17 17:11 LeadSongDog

Do we strip from our indexing as well? If seems like a good bet that we should remove punctuation

mekarpeles avatar Nov 09 '17 18:11 mekarpeles

Can't claim that I understand the code, but I think we must. It looks like it relates to something near: https://github.com/internetarchive/openlibrary/blob/7fe1ca1774fd95b1e9fa4710db72bff3afaa225d/openlibrary/plugins/search/code.py#L528 and/or: https://github.com/internetarchive/openlibrary/blob/7fe1ca1774fd95b1e9fa4710db72bff3afaa225d/vendor/js/jquery-validate/additional-methods.js#L7

LeadSongDog avatar Nov 09 '17 18:11 LeadSongDog

I've been able to upload images with " in the name, but it still looks like search doesn't properly encode curly quotes. I think this may tangentially related to #333

@mekarpeles I'm defaulting to asking you to be assignee. Note, being the assignee doesn't necessarily mean you are responsible for doing the work, just responsible for gathering/providing information to address the issue. From the Wiki.

The assigned owner is not necessarily the person who will fix the issue (it is not necessarily even established, at that point, if or when the issue will be fixed at all), but rather they are the person who will do as much or as little as needed to handle the issue (asking questions, soliciting input, establishing and updating the priority, checking if it is a duplicate, etc).

Once an issue is labeled State: Work In Progress, the owner is the individual doing the work, or leading/coordinating the group that is doing the work.

I've added labels per context: let me know your thoughts

xayhewalo avatar Oct 24 '19 00:10 xayhewalo

This bug is adequately described from my point of view. I'd avoid doing any character removal in Python / Javascript, but rather depend on the Solr analyzers used for indexing and querying. The front end focus should be on making sure that the query string gets appropriately encoded as a URL and escaped for Solr special characters. I consider this a medium priority search bug.

tfmorris avatar Oct 25 '19 02:10 tfmorris

Assigning @cdrini per our slack conversation since he's tackling the url encoding for #333

xayhewalo avatar Oct 31 '19 23:10 xayhewalo