From 9af592f1b2702de39cbe8aabdce210c34499433b Mon Sep 17 00:00:00 2001 From: Tobias Macey Date: Tue, 13 Mar 2018 11:38:28 -0400 Subject: [PATCH] Added logic to remove query params from image url in student view The student assignment view was unable to load uploaded microscopy images because of an expiration parameter being appended to the S3 URL. This PR strips all query params from those URLs as they are not needed. --- instructor/compiler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/instructor/compiler.py b/instructor/compiler.py index a2e4d4a1..25a3d330 100644 --- a/instructor/compiler.py +++ b/instructor/compiler.py @@ -1,3 +1,4 @@ +from urlparse import urlparse, urlunparse from django.db.models import Q from django.utils.html import format_html, format_html_join from instructor.models import ( @@ -362,7 +363,8 @@ def micro_model(a): def generate_slides(assignment): ret = {} for image in assignment.image.all(): - ret[image.id] = image.file.url + image_url = urlparse(image.file.url)._replace(query=None) + ret[image.id] = urlunparse(image_url) return ret