Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16792 closed Bug (invalid)

File Browser error handling

Reported by: yev Owned by:
Priority: Normal Milestone:
Component: File Browser Version:
Keywords: Cc:

Description

I am using File Browser and File Uploader plugins. One of the requirements for me is to prevent requests exceeding some max size from succeeding on the server side. The server echoes back a json: {"uploaded":0,"error":{"message":"Too large: 10,240Kb"}}

File Uploader (copy/paste directly into editor) works. I get a balloon message: 'Network error occurred during file upload.'

But File Browser does not work. It shows no useful message except for broken page inside the uploader iframe. And the worst part is - it completely hoses the Dialog. User can no longer exit it or re-upload new file. It shows this error: VM2738:formatted:2659 Uncaught DOMException: Blocked a frame with origin "http://localhost" from accessing a cross-origin frame.

Browser: Chrome, OSX, CkEditor 4.5.11, plugins : {

'autogrow' : 1, 'basicstyles' : 1, 'clipboard' : 1, 'colorbutton' : 1, 'entities' : 1, 'filebrowser' : 1, 'floatingspace' : 1, 'font' : 1, 'htmlwriter' : 1, 'image' : 1, 'indentblock' : 1, 'indentlist' : 1, 'justify' : 1, 'link' : 1, 'list' : 1, 'magicline' : 1, 'maximize' : 1, 'pastefromword' : 1, 'pastetext' : 1, 'sourcearea' : 1, 'tab' : 1, 'toolbar' : 1, 'undo' : 1, 'uploadimage' : 1, 'wysiwygarea' : 1

},

Attachments (5)

Screen Shot 2017-01-11 at 11.28.12 AM.png (30.6 KB) - added by yev 3 years ago.
upload dialog shows broken uploader-iframe, not exitable
Screen Shot 2017-01-11 at 11.29.47 AM.png (92.3 KB) - added by yev 3 years ago.
uploader-iframe, generated by Chrome itself.
Screen Shot 2017-01-11 at 11.33.30 AM.png (88.1 KB) - added by yev 3 years ago.
Clicking Cancel results in these errors
works.png (101.5 KB) - added by Jakub Ś 3 years ago.
works2.png (121.2 KB) - added by Jakub Ś 3 years ago.

Download all attachments as: .zip

Change History (8)

Changed 3 years ago by yev

upload dialog shows broken uploader-iframe, not exitable

Changed 3 years ago by yev

uploader-iframe, generated by Chrome itself.

Changed 3 years ago by yev

Clicking Cancel results in these errors

comment:1 Changed 3 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

The error you are getting has nothing to do with file being too big. I'm not sure what you are doing but you are getting into cross origin issues.

Please have a look at attached file. I have CKEditor used with CKFinder where in CKFinder I can define maximum size for a single image and if this value is exceeded, appropriate message will be returned. I'm not sure if you are using any server-side or not but you must know that file browser plugin won't work by itself. It requires some sort of server-side which will upload file and return appropriate message.

Please see this link or better every link mentioned in File Manager section: http://docs.ckeditor.com/#!/guide/dev_file_browser_api

Changed 3 years ago by Jakub Ś

Attachment: works.png added

comment:2 in reply to:  1 Changed 3 years ago by yev

I am using Tomcat/Spring/Java on the server side. I am explicitly limiting the multipart upload size from server side to prevent large uploads eating my resources. I set it 10Mb. But Tomcat itself will abort a connection at some cutoff point. I set that to 15mb (maxSwallowSize="15000000"). So unless I open up my Tomcat instance to unlimited upload buffers, my application code cannot respond with JSONP back to the client for even larger uploads. The client just sees the terminated connection.

Looks like File Uploader handles this scenario gracefully, but File Browser does not.

The cross domain issue is a result of Chrome writing out a canned/built-in error page inside the uploader IFRAME, and File Browser is perhaps trying to access it.

Replying to j.swiderski:

The error you are getting has nothing to do with file being too big. I'm not sure what you are doing but you are getting into cross origin issues.

Please have a look at attached file. I have CKEditor used with CKFinder where in CKFinder I can define maximum size for a single image and if this value is exceeded, appropriate message will be returned. I'm not sure if you are using any server-side or not but you must know that file browser plugin won't work by itself. It requires some sort of server-side which will upload file and return appropriate message.

Please see this link or better every link mentioned in File Manager section: http://docs.ckeditor.com/#!/guide/dev_file_browser_api

comment:3 Changed 3 years ago by Jakub Ś

Please see: http://docs.ckeditor.com/#!/guide/dev_file_browser_api and http://docs.ckeditor.com/#!/guide/dev_file_upload-section-server-side-configuration and http://docs.ckeditor.com/#!/guide/dev_file_browser_api-section-example-4

The FileBrowser is just a JavaScript plugin which expects JavaScript response from your server-side. It is your server side which needs to abort the upload and send the response - FileBrowser is not responsible for that.

Please read the links I have attached and have a look at the attached image to see how CKFinder is doing it. Please also remember that File Browser expects response in a certain format. Your server-side code must comply with these rules.

Changed 3 years ago by Jakub Ś

Attachment: works2.png added
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy