You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When attempting to configure file uploads, uploadMaxChunkSize does not behave as expected:
Setting uploadMaxChunkSize to a large value (e.g., 1GB) still results in files being chunked at approximately 2MB.
Setting uploadMaxChunkSize: 0 (intending to disable chunking) causes the browser to hang, even for very small files (e.g., 2KB).
Investigation into the elFinder source code (specifically the upload handling function, around line where effective chunk size Y is calculated) reveals a line similar to: Y = Math.min((this.uplMaxSize ? this.uplMaxSize : 2097152) - buffer, this.options.uploadMaxChunkSize)
It appears this.uplMaxSize defaults to NaN or is not properly initialized from options, causing the 2097152 (2MB) default to always take precedence in the Math.min calculation if this.uplMaxSize is falsy (like NaN).
Furthermore, when this.options.uploadMaxChunkSize is 0, the calculated effective chunk size Y becomes 0. The subsequent file slicing logic file.slice(start, start + Y) then attempts to create 0-byte slices, likely leading to an infinite loop or browser hang.
Attempt to upload a file larger than 2MB (e.g., 5MB).
o Expected behavior: File uploads in one chunk (or chunks respecting the 1GB limit).
o Actual behavior: File is uploaded in ~2MB chunks. The filename for these chunks may appear as "blob" and Content-Type as application/octet-stream at the backend if the backend isn't equipped for chunking.
Attempt to upload any file (e.g., 2KB).
o Expected behavior: File uploads as a single, non-chunked request.
o Actual behavior: The browser UI hangs indefinitely.
Workaround Found:
Manually setting the internal property after initialization seems to allow uploadMaxChunkSize to be respected for larger chunk sizes: $('#elfinder').elfinder('instance').uplMaxSize = 50 * 1024 * 1024;
This suggests uplMaxSize is not being correctly initialized or made configurable through standard options.
Expected behavior
uploadMaxChunkSize should correctly define the chunk size, or disable chunking if set to 0, without being overridden by a fixed ~2MB internal limit unless uploadMaxChunkSize is larger than that internal limit (if such a limit is intended by design and configurable).
uploadMaxChunkSize: 0 should reliably disable chunking and not cause the browser to hang.
The internal uplMaxSize property should either be configurable via options or initialized to a value that doesn't improperly restrict uploadMaxChunkSize.
Environment
• elFinder version: [Your elFinder Version, e.g., 2.1.65]
• Browser name and version: [e.g., Chrome 136.0.7103.114]
• jQuery version: [Your jQuery Version, e.g., 3.6.0]
• Custom python connector for select commands needed. Upload handling is not setup for chunking which made this bug apparent. Additional context
The primary issue seems to be the handling of the internal uplMaxSize variable and the logic for when uploadMaxChunkSize is set to 0. The workaround of manually setting instance.uplMaxSize indicates that if this internal variable had a proper large value, uploadMaxChunkSize would likely function more as expected for values greater than 2MB. The hang with 0 points to a flaw in the "disable chunking" path.
The text was updated successfully, but these errors were encountered:
Describe the bug
When attempting to configure file uploads, uploadMaxChunkSize does not behave as expected:
Investigation into the elFinder source code (specifically the upload handling function, around line where effective chunk size Y is calculated) reveals a line similar to:
Y = Math.min((this.uplMaxSize ? this.uplMaxSize : 2097152) - buffer, this.options.uploadMaxChunkSize)
It appears this.uplMaxSize defaults to NaN or is not properly initialized from options, causing the 2097152 (2MB) default to always take precedence in the Math.min calculation if this.uplMaxSize is falsy (like NaN).
Furthermore, when this.options.uploadMaxChunkSize is 0, the calculated effective chunk size Y becomes 0. The subsequent file slicing logic file.slice(start, start + Y) then attempts to create 0-byte slices, likely leading to an infinite loop or browser hang.
To Reproduce
o Expected behavior: File uploads in one chunk (or chunks respecting the 1GB limit).
o Actual behavior: File is uploaded in ~2MB chunks. The filename for these chunks may appear as "blob" and Content-Type as application/octet-stream at the backend if the backend isn't equipped for chunking.
o Expected behavior: File uploads as a single, non-chunked request.
o Actual behavior: The browser UI hangs indefinitely.
Workaround Found:
Manually setting the internal property after initialization seems to allow uploadMaxChunkSize to be respected for larger chunk sizes:
$('#elfinder').elfinder('instance').uplMaxSize = 50 * 1024 * 1024;
This suggests uplMaxSize is not being correctly initialized or made configurable through standard options.
Expected behavior
Environment
• elFinder version: [Your elFinder Version, e.g., 2.1.65]
• Browser name and version: [e.g., Chrome 136.0.7103.114]
• jQuery version: [Your jQuery Version, e.g., 3.6.0]
• Custom python connector for select commands needed. Upload handling is not setup for chunking which made this bug apparent.
Additional context
The primary issue seems to be the handling of the internal uplMaxSize variable and the logic for when uploadMaxChunkSize is set to 0. The workaround of manually setting instance.uplMaxSize indicates that if this internal variable had a proper large value, uploadMaxChunkSize would likely function more as expected for values greater than 2MB. The hang with 0 points to a flaw in the "disable chunking" path.
The text was updated successfully, but these errors were encountered: