Rostlab / JS16_ProjectA

In this project we will lay the foundations for our system by integrating data from multiple sources into a central database. The database will serve the apps and the visualization tool that will be developed in other projects.
GNU General Public License v3.0
28 stars 14 forks source link

Character by Name with curly braces #111

Closed yashha closed 8 years ago

yashha commented 8 years ago

https://got-api.bruck.me/api/characters/Will%20(squire) Doesn't work, how can I fix it?

togiberlin commented 8 years ago

Hello @yashha , if you want to query a character which has some symbols like ( ) or { } or [ ] in his/her name simply use backslash \ before every symbol. This tells the regular expression to also take these symbols into account. See my example below:

Your previous GET request which breaks: https://got-api.bruck.me/api/characters/Will%20(squire)

Solution which works: https://got-api.bruck.me/api/characters/Will%20\(squire\) Notice the backslash symbols \

sacdallago commented 8 years ago

For me https://got-api.bruck.me/api/characters/Will%20\(squire\) redirects to apidocs?

kordianbruck commented 8 years ago

@sacdallago ye, escaping in URLs does not work. The real fix is #100

togiberlin commented 8 years ago

@sacdallago @kordianbruck @yashha My fix works perfectly with Safari but it doesn't work with Chrome/Firefox. Sorry! In Chrome/FF, it automatically converts backslashes to normal slashes.

To suppress this behavior, go one step further and simply replace \ with %5C Example: https://got-api.bruck.me/api/characters/Will%20%5C(squire%5C)

sacdallago commented 8 years ago

:D simply put, URL encode the search term @yashha

yashha commented 8 years ago

thanks! :)