Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #350 #351

Merged
merged 1 commit into from
Apr 7, 2020
Merged

fixed #350 #351

merged 1 commit into from
Apr 7, 2020

Conversation

alexhuang091
Copy link
Contributor

@alexhuang091 alexhuang091 commented Apr 7, 2020

fixed #350

Because encodeURIComponent doesn't encode single quote, when fqParam contains '. the value of the input is not properly constructed.

Screen Shot 2020-04-07 at 10 20 20 am

for example when fqParam = taxon_name%3A%22'Ochlerotatus'%20daliensis%22
<input type="checkbox" name="fqs" class="fqs" value="taxon_name%3A%22" ochlerotatus'%20daliensis%22'="">

The solution is, since encodeURIComponent encodes double quote, then fqParam already has double quotes escaped, use " to construct the value.

Did a test with the above fix.
Selected these fitlers (total 235 records expected)
Screen Shot 2020-04-07 at 10 07 31 am

Actual result record amount is correct.
Screen Shot 2020-04-07 at 10 07 45 am

And the URL is correct.

https://localhost:8080/ala-hub/occurrences/search?q=*:*&fq=(taxon_name:"'Ochlerotatus'" OR taxon_name:"'Ochlerotatus' ('Finlaya') britteni" OR taxon_name:"'Ochlerotatus' ('Finlaya') candidoscutellum" OR taxon_name:"'Ochlerotatus' ('Finlaya') monocellatus" OR taxon_name:"'Ochlerotatus' ('Finlaya') subauridorsum" OR taxon_name:"'Ochlerotatus' ('Finlaya') wasselli" OR taxon_name:"'Ochlerotatus' daliensis" OR taxon_name:"'Stolasterias")

Did another test which includes filters with both ' and ".
Result records amount is wrong because of https://github.com/AtlasOfLivingAustralia/biocache-service/issues/440 but constructed URL is correct.
Screen Shot 2020-04-07 at 10 13 24 am

https://localhost:8080/ala-hub/occurrences/search?q=*:*&fq=(taxon_name:""Cyclophora" lechriostropha" OR taxon_name:""Cyclophora" rhodobapta" OR taxon_name:""Cyclophora" sticta" OR taxon_name:"'Ochlerotatus'" OR taxon_name:"'Ochlerotatus' ('Finlaya') britteni" OR taxon_name:"'Ochlerotatus' ('Finlaya') candidoscutellum" OR taxon_name:"'Stolasterias")

Because encodeURIComponent doesn't encode single quote, when fqParam contains '. the value of input is not properly constructed.

Solution is, since encodeURIComponent encodes double quote, then fqParam already has double quotes escaped, use " to construct the value.
@nickdos nickdos merged commit 59bcc01 into master Apr 7, 2020
@sbearcsiro sbearcsiro mentioned this pull request Apr 7, 2020
sbearcsiro added a commit that referenced this pull request Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants