RunestoneComponents icon indicating copy to clipboard operation
RunestoneComponents copied to clipboard

Course names with special characters in them cannot be deleted

Open irunestone opened this issue 6 years ago • 2 comments

Error reported in course thinkcspy on page /runestone/default/removecourse/HTML&CSS by user [email protected] [email protected] Please describe what you were doing that led up to this error:

---------------- Traceback -------------- Traceback (most recent call last): File "/home/bmiller/Runestone/web2py/gluon/restricted.py", line 219, in restricted exec(ccode, environment) File "/home/bmiller/Runestone/web2py/applications/runestone/controllers/default.py", line 394, in File "/home/bmiller/Runestone/web2py/gluon/globals.py", line 409, in self._caller = lambda f: f() File "/home/bmiller/Runestone/web2py/gluon/tools.py", line 3964, in f return action(*a, **b) File "/home/bmiller/Runestone/web2py/applications/runestone/controllers/default.py", line 299, in removecourse db((db.user_courses.user_id == auth.user.id) & (db.user_courses.course_id == course_id_query[0].id)).delete() File "/home/bmiller/Runestone/web2py/gluon/packages/dal/pydal/objects.py", line 2702, in getitem row = self.records[i] IndexError: list index out of range

irunestone avatar Jul 03 '18 08:07 irunestone

99% sure that this is because of the & in the course name. Course names should be encoded before calling the remove course controller. This should be fixed in the template for the remove controller where each possible course is set up as a separate form with the action linked to include an un-escaped course name.

bnmnetp avatar Jul 03 '18 14:07 bnmnetp

I figured you cannot add a course with an "&" on in from the browser anymore, meaning that you will never have the need to delete it. However, instructors can still add such a course from the terminal using "rsmanage addcourse", which then brings the problem back. If we can find a way to prevent adding a course with special characters from the terminal, that would fix the problem completely.

knakaj avatar Jul 29 '22 14:07 knakaj