mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix handline of large file uploads and properly show any errors that may occur. Fixes #2153
This commit is contained in:
committed by
Dave Page
parent
dcc74af87b
commit
8bbcf0ab36
@@ -886,10 +886,14 @@ class Filemanager(object):
|
||||
newName = u"{0}{1}".format(orig_path, file_name)
|
||||
|
||||
with open(newName, 'wb') as f:
|
||||
f.write(file_obj.read())
|
||||
while True:
|
||||
data = file_obj.read(4194304) # 4MB chunk (4 * 1024 * 1024 Bytes)
|
||||
if not data:
|
||||
break
|
||||
f.write(data)
|
||||
except Exception as e:
|
||||
code = 0
|
||||
err_msg = u"Error: {0}".format(e.strerror)
|
||||
err_msg = u"Error: {0}".format(e.strerror if hasattr(e, 'strerror') else u'Unknown')
|
||||
|
||||
try:
|
||||
Filemanager.check_access_permission(dir, path)
|
||||
|
||||
@@ -1624,7 +1624,7 @@ if (has_capability(data, 'upload')) {
|
||||
complete: function(file) {
|
||||
if (file.status == "error") {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.error(lg.ERROR_UPLOADING_FILE);
|
||||
alertifyWrapper.error(lg.upload_error);
|
||||
}
|
||||
$('.upload_file .dz_cross_btn').removeAttr('disabled');
|
||||
getFolderInfo(path);
|
||||
|
||||
Reference in New Issue
Block a user