Commit 18cf826f by Victor Shnayder

Remove trailing slash from ajax url in ModuleSystem

* also add a check for valid location in modx_dispatch
parent 06495795
...@@ -198,6 +198,8 @@ def _get_module(user, request, location, student_module_cache, course_id, positi ...@@ -198,6 +198,8 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
location=descriptor.location.url(), location=descriptor.location.url(),
dispatch=''), dispatch=''),
) )
# Intended use is as {ajax_url}/{dispatch_command}, so get rid of the trailing slash.
ajax_url = ajax_url.rstrip('/')
# Fully qualified callback URL for external queueing system # Fully qualified callback URL for external queueing system
xqueue_callback_url = '{proto}://{host}'.format( xqueue_callback_url = '{proto}://{host}'.format(
...@@ -410,6 +412,10 @@ def modx_dispatch(request, dispatch, location, course_id): ...@@ -410,6 +412,10 @@ def modx_dispatch(request, dispatch, location, course_id):
''' '''
# ''' (fix emacs broken parsing) # ''' (fix emacs broken parsing)
# Check parameters and fail fast if there's a problem
if not Location.is_valid(location):
raise Http404("Invalid location")
# Check for submitted files and basic file size checks # Check for submitted files and basic file size checks
p = request.POST.copy() p = request.POST.copy()
if request.FILES: if request.FILES:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment