stumash / CoursePlanner

http://conucourseplanner.online
MIT License
5 stars 3 forks source link

filtercoursecodes API returning weird results #124

Closed Davidster closed 6 years ago

Davidster commented 6 years ago

If you perform the following api request:

curl -H "Content-Type: application/json" -X POST -d '{"filter":"COMP 24*"}' http://conucourseplanner.online/filtercoursecodes

The server returns the following response:

["COMP 201","COMP 208","COMP 218","COMP 228","COMP 232","COMP 233","COMP 248","COMP 249"]

This response doesn't really make sense, anyone have any idea why it's happening?


The response for that filter query should really be something like

["COMP 248","COMP 249"]

I think it's pretty cool that you can put special characters into the search filter, but we should definitely look into whether there are security concerns (a la SQL injection) with this feature. If we want to keep supporting special characters (I think it accepts any regex, but I'm really not sure), then we should definitely make sure the correct results are returned.

Davidster commented 6 years ago

Just realized that this only confused me due to my lack of understanding of regex. Instead of /COMP 24*/, I should've been passing: /COMP 24./