mirror of
https://github.com/django/django.git
synced 2024-12-25 10:35:48 +00:00
Added an import that was missed in [8193]. Thanks Karen Tracey. Fixed #8143.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8233 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
169b889486
commit
afa98dba98
@ -1,9 +1,9 @@
|
|||||||
import os
|
import os
|
||||||
import sha
|
|
||||||
from django.core.files.uploadedfile import UploadedFile
|
from django.core.files.uploadedfile import UploadedFile
|
||||||
from django.http import HttpResponse, HttpResponseServerError
|
from django.http import HttpResponse, HttpResponseServerError
|
||||||
from django.utils import simplejson
|
from django.utils import simplejson
|
||||||
from uploadhandler import QuotaUploadHandler
|
from uploadhandler import QuotaUploadHandler
|
||||||
|
from django.utils.hashcompat import sha_constructor
|
||||||
|
|
||||||
def file_upload_view(request):
|
def file_upload_view(request):
|
||||||
"""
|
"""
|
||||||
@ -39,9 +39,9 @@ def file_upload_view_verify(request):
|
|||||||
continue
|
continue
|
||||||
submitted_hash = form_data[key + '_hash']
|
submitted_hash = form_data[key + '_hash']
|
||||||
if isinstance(value, UploadedFile):
|
if isinstance(value, UploadedFile):
|
||||||
new_hash = sha.new(value.read()).hexdigest()
|
new_hash = sha_constructor(value.read()).hexdigest()
|
||||||
else:
|
else:
|
||||||
new_hash = sha.new(value).hexdigest()
|
new_hash = sha_constructor(value).hexdigest()
|
||||||
if new_hash != submitted_hash:
|
if new_hash != submitted_hash:
|
||||||
return HttpResponseServerError()
|
return HttpResponseServerError()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user