Ticket #1693 (closed Bug: fixed)

Opened 19 months ago

Last modified 17 months ago

Filemanager not returning error message (Javascript)

Reported by: redtopia Owned by: wwalc
Priority: Normal Milestone: FCKeditor 2.6
Component: File Browser Version: FCKeditor 2.5
Keywords: Confirmed Review+ Cc:

Description

I was having a problem with ColdFusions server not returning a valid temp directory when uploading a file. A empty Javascript alert popped up telling me nothing. After some debugging, I found that the message that was generated from a coldfusion exception was not being passed through to the function OnUploadCompleted () in the file: filemanager/browser/default/frmupload.html.

To reproduce:

Edit the file: filemanager\browser\default\connectors\cfm\cf_commands.cfm

Delete destination="#GetTempDirectory()#" from the cffile call. Replace it with an empty string. This will give you an invalid directory, and an exception will be thrown.

Try uploading a file into the file manager browser. A blank alert will appear.

The Fix:

The file filemanager/browser/default/browser.html has a function in it:

function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )

This function accepts a customMsg that contains the message from an exception in the connector script. This message is not being passed to the function (with the same name) that it calls. You need to pass customMsg to the OnUploadCompleted in the file upload frame, as follows:

function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) {

window.framesfrmUpload?.OnUploadCompleted( errorNumber, fileName, customMsg ) ;

}

Then you need to modify the called function to accept the new parameter.

In the file:

file filemanager/browser/default/frmupload.html

add the paramter to the end of the param list:

function OnUploadCompleted( errorNumber, data, customMsg )

Then use it to display in the alert for error number 1:

switch ( errorNumber ) {

case 0 :

window.parent.framesfrmResourcesList?.Refresh() ; break ;

case 1 : // Custom error.

alert( customMsg ) ; break ;

Attachments

browser_OnUploadCompleted.patch (0.5 KB) - added by wwalc 17 months ago.

Change History

Changed 17 months ago by wwalc

Changed 17 months ago by wwalc

  • keywords Confirmed Review? added
  • owner set to wwalc
  • milestone set to FCKeditor 2.6

Changed 17 months ago by fredck

  • keywords Review+ added; Review? removed

Please include the changelog on commit.

Changed 17 months ago by wwalc

  • status changed from new to closed
  • resolution set to fixed

Fixed with [1566].

Note: See TracTickets for help on using tickets.