diff --git a/cms/djangoapps/contentstore/views/import_export.py b/cms/djangoapps/contentstore/views/import_export.py index 37d9ed4ed3..ab359862b1 100644 --- a/cms/djangoapps/contentstore/views/import_export.py +++ b/cms/djangoapps/contentstore/views/import_export.py @@ -89,16 +89,20 @@ def import_course(request, org, course, name): # Check to make sure we haven't missed a chunk # This shouldn't happen, even if different instances are handling # the same session, but it's always better to catch errors earlier. - if size != int(content_range['start']): + if size < int(content_range['start']): log.warning( "Reported range %s does not match size downloaded so far %s", - size, - content_range['start'] + content_range['start'], + size ) return JsonResponse( {'ErrMsg': 'File upload corrupted. Please try again'}, status=409 ) + # The last request sometimes comes twice. This happens because + # nginx sends a 499 error code when the response takes too long. + elif size > int(content_range['stop']) and size == int(content_range['end']): + return JsonResponse({'ImportStatus': 1}) with open(temp_filepath, mode) as temp_file: for chunk in request.FILES['course-data'].chunks(): diff --git a/cms/static/sass/views/_import.scss b/cms/static/sass/views/_import.scss index 1f9c62d917..e9701c14cf 100644 --- a/cms/static/sass/views/_import.scss +++ b/cms/static/sass/views/_import.scss @@ -57,6 +57,11 @@ body.course.import { color: $error-red; } + .status-block { + display: none; + font-size: 13px; + } + .choose-file-button { @include blue-button; padding: 10px 50px 11px; diff --git a/cms/templates/import.html b/cms/templates/import.html index d39ee30b11..a5c6b9f412 100644 --- a/cms/templates/import.html +++ b/cms/templates/import.html @@ -34,6 +34,7 @@ +
Unpacking...