Opened 4 years ago

Closed 4 years ago

#13650 closed Bug (fixed)

Ruby on Rails - Drag and drop image upload not working

Reported by: CptMaumau Owned by:
Priority: Normal Milestone:
Component: Documentation & Samples Version:
Keywords: Cc:

Description

Steps to reproduce

  1. Launch Rails server
  2. Launch editor
  3. Drag and drop image

Expected result

Image successfully uploaded

Actual result

Client side: HTTP error occurred during file upload (404: File not found).

Server side: ActionController::RoutingError (No route matches [POST] "/ckeditor/pictures&responseType=json")

Other details (browser, OS, CKEditor version, installed plugins)

Firefox 39.0.3, Linux Mint 17, CKEditor 4.5.2.

plugins: lineutils,widget,autolink,sharedspace,image2,youtube,confighelper,pastefromword,autogrow,notification,notificationaggregator,filetools,uploadwidget,uploadimage

I think the bug comes from the url used to upload which has an & instead of a ? so Rails fail in interpreting the request.

Change History (9)

comment:1 Changed 4 years ago by Piotrek Koszuliński

Keywords: Drag and Drop Ruby on Rails removed
Resolution: invalid
Status: newclosed
Version: 4.5.2

The error that you paste means that your backend does not work (the route does not exist). That's not CKEditor's bug.

comment:2 Changed 4 years ago by CptMaumau

But isn't it abnormal to have a url format like that?

Shouldn't it be: /ckeditor/pictures?responseType=json

comment:3 Changed 4 years ago by Piotrek Koszuliński

Resolution: invalid
Status: closedreopened

You're right. I missed that. I recall that there's some tricky situation with which config option you use (I guess you used filebrowserUploadUrl or filebrowserImageUploadUrl). I'll pass this to my colleague.

comment:4 Changed 4 years ago by Piotr Jasiun

You should use uploadUrl instead of filebrowserUploadUrl. uploadUrl is the proper configuration for image upload. filebrowserUploadUrl is the old configuration for a filebrowser plugin and it adds &responseType=json and is used by image upload only because of the backward compatibility with some file browsers.

I will add a comment to the filebrowserUploadUrl config to make it clear.

comment:5 Changed 4 years ago by Jakub Ś

Component: GeneralDocumentation & Samples
Status: reopenedconfirmed

comment:6 Changed 4 years ago by CptMaumau

Thank you for the response.

I have now another issue, when I try to drag and drop an image on the server side it raises: WARNING: Can't verify CSRF token authenticity

This is due to the request not sending an authenticity_token.

Maybe this is an error from the gem I am using so I will also notify them.

comment:7 Changed 4 years ago by Piotr Jasiun

This is a CKEditor bug tracker, not a support channel. The open support channel for CKEditor is Stack Overflow. Also note that your question is about the Ruby on Rails plugin, CKEditor do not use any authenticity_token, as far as I know.

Last edited 4 years ago by Piotr Jasiun (previous) (diff)

comment:8 Changed 4 years ago by Piotrek Koszuliński

The implementation of CSRF has of course nothing to do with CKEditor. It needs to be done by the backend. CKEditor, however, perhaps needs to integrate with this too (to use the CSRF) and for that the http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-fileUploadRequest event may be used.

comment:9 Changed 4 years ago by Piotr Jasiun

Resolution: fixed
Status: confirmedclosed

I have updated docs, I have added note to the filebrowserUploadUrl configuration options. I will be available in docs.ckeditor.com after the docs rebuild.

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