From e3bf14dab85795ec305da37dbcea5c0f11127290 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 5 Feb 2014 06:37:00 +0000 Subject: [PATCH] send Access-Control-Allow-Origin but no data for OPTIONS requests --- pandora/item/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora/item/views.py b/pandora/item/views.py index 598662a7..63a384a7 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -726,7 +726,8 @@ def frame(request, id, size, position=None): frame = os.path.join(settings.STATIC_ROOT, 'jpg/list256.jpg') #raise Http404 response = HttpFileResponse(frame, content_type='image/jpeg') - response['Access-Control-Allow-Origin'] = '*' + if request.method == 'OPTIONS': + response.allow_access() return response def poster_frame(request, id, position): @@ -832,7 +833,8 @@ def timeline(request, id, size, position=-1, format='jpg', mode=None): mode = modes.pop(0) path = timeline() response = HttpFileResponse(path, content_type='image/jpeg') - response['Access-Control-Allow-Origin'] = '*' + if request.method == 'OPTIONS': + response.allow_access() return response def download(request, id, index=1):