Utopian Search #keyword hashtag is not escaped

Words
211
Reading
1 min
Listen
Play
9y

There are two types queries for two different endpoints based on the category as far as i see. Github api search and utopian api.

Expected behavior

Should url encode the hashtag and ad return results properly for github.
Should keep the hashtag and url encode properly for the utopian api search.

Actual behavior

When the search is done through Github the following is returned:

{
  "message": "Validation Failed",
  "errors": [
    {
      "resource": "Search",
      "field": "q",
      "code": "missing"
    }
  ],
  "documentation_url": "https://developer.github.com/v3/search"
}

The q parameter aka the search term is missing, it is ignored because of the hashtag.

When searching on utopian api the search term is missing in the request


Sends a query of:

https://api.utopian.io/api/posts/?limit=20&skip=0&section=all&sortBy=created&type=sub-projects&bySimilarity=&reset=
bySimilarity=

is empty while it should have been

bySimilarity=%23test

How to reproduce

Go to utopian.io
Make sure in the search box you selected Projects: (For github search)
Type #busy

Search fails with hashtag.

Now try with Development category
And type busy:

Search works. But when you try with hashtag #busy search

Tested on:

  • Browser: Firefox, Chrome
  • Operating system: Windows 10, Ubuntu

Related Issue:

https://github.com/utopian-io/utopian.io/issues/26

For clarification:
The linked issue is a feature request of searching by tags.

My issue is a bug report of being unable to search when the search term starts with hashtags. I found the explained bug above while examining the github issue.



Posted on Utopian.io - Rewarding Open Source Contributors

Utopian Search #keyword hashtag is not escaped | Ecency