Skip to content

Commit

Permalink
Added logic to remove query params from image url in student view
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blarghmatey committed Mar 13, 2018
1 parent e99769c commit 9af592f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion instructor/compiler.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 9af592f

Please sign in to comment.