elFinder
elFinder copied to clipboard
"TypeError: Cannot read property 'debug' of undefined"
Hi,
I'm getting a "TypeError: Cannot read property 'debug' of undefined" error if:
- I click download on a file
- the server responds to the download request with an error
- I click the "x" in "Downloading files" to cancel the request
This seems to demonstrate two bugs:
- No error is displayed when the download link fails. It should display an error and no longer show the "Downloading" progress box
- Clicking the "x" button to abort is not properly handling the valid (204) response
Could you please take a look and lmk if you need any further information to identify and/or resolve these issues?
Thank you much
@liquidaty This is a nasty problem. When downloading with a modern browser, clicking Download will bring it under the control of the browser. I don't know how to catch that progress in JavaScript.
One thing I would like to ask is "TypeError: Cannot read property 'debug' of undefined". Do you know where the error occurred?
When downloading with a modern browser, clicking Download will bring it under the control of the browser
It doesn't have to be that way. IMHO a much better way to handle this would be to not hand control over to the browser. Instead, create a new XMLHttpRequest()
object to fetch the URL, with an onload
handler that will fetch the xhr.response
into a blob and programmatically invoke the downloaded through a regular download-local-content routine (e.g. that would typically make a call to URL.createObjectURL()
).
This should be no problem for files of up to several gigabytes in size, and gives you full control over the entire process as the data comes over the wire. This would probably prove useful for many other reasons as well.
The only drawback I can think of is that if you're downloading a large file and you want the user to see progress over time, then when you give the browser control, the browser will do that for you, whereas with the above approach, you need to add some of your own code to do that. But that's a fairly easy thing to code and there are a lot of other advantages to this approach that are not available otherwise.
This issue is stale because it has been open for 50 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.