WikiEducationFoundation / WikiEduDashboard

Wiki Education Foundation's Wikipedia course dashboard system
https://dashboard.wikiedu.org
MIT License
392 stars 630 forks source link

Course Titles with "/" fail to load #3232

Closed bwreid closed 2 years ago

bwreid commented 5 years ago

What is happening?

If a course title includes a /, the slug will also include that /. It will make it so that visiting the course is impossible.

To Reproduce

  1. Create a new course with / in the title.
  2. Try and go to that course.

Expected behavior

A valid URL should be generated. For example, swap / with _

ragesoss commented 5 years ago

I'm not able to reproduce this, as I can't create a course title that includes a /. It's already being disallowed by the frontend regex.

Was there a production course that ended up with an extra slash in the title (as opposed to the normal slash between school and title)?

bwreid commented 5 years ago

There was! I'll forward you the email chain.

ragesoss commented 5 years ago

I haven't figured out how courses with a slash in the school field got created in the first place. The validation regex blocks a forward slash in CourseCreator, Details, and CourseClonedModal — all the places where it's possible to set or change the school field.

This got fixed by adjusting the school name: https://dashboard.wikiedu.org/courses/LaGuardia_Community_College_-_St._Petersburg's_Polytechnic_University/ENA-G_101-Composition_(COIL)_(Fall_2019)

However, that slug also does not pass frontend validation, because parentheses are not allowed in the course title field.

The user who did this seems to have bypassed the regex-based validations. Perhaps there are browsers where the regex does not work but the rest of the frontend largely does work?

ragesoss commented 2 years ago

This hasn't happened again.