Download & Extend

WebFM ajax calls fails if Browser responseText contains leading whitespace / line feeds.

Project:Web File Manager
Version:6.x-2.11
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

WebFM was not working correctly on my Windows development box (Windows XP, Apache 2.2, MySQL, PhP... installed individually). The main symptoms were:

- Only file box shown (right side) with no folders box.
- Files would upload but go to the Drupal upload directory and not to the WebFM root

This occured both in FF 3.5 and IE 7.

After splunking around for a day or so, I finally found the problem in webfm.js. The XMLHttpRequest object was returning a response string that started with 2 or 3 linefeed (0x10) characters. This was breaking the conversion to JSON.

Note that debug output did not show these... you have to get the character code to see them.

Anyway, the solution was to modify the Webfm.HTTPPost function so that xmlHttp.responseText was wrapped in a Webfm.trim(..) call.

Specifically, in the js/webfm.js file, change lines 3743 and 3749 to look like the ones below:

3743: callbackFunction(Webfm.trim(xmlHttp.responseText), xmlHttp, callbackParameter);

3749: return Webfm.trim(xmlHttp.responseText);

FWIW - In researching this, I saw several issues talking about Windows installs not working in various manners. I suspect this fix will solve a lot of these.

Comments

#1

Here's a patch from the CVS head with the changes documented above.

AttachmentSize
webfm-178656-1.patch 800 bytes

#2

Excellent fix. I had almost given up on WebFM, but this worked perfectly. Thank you for your hard work!

#3

Slight correction.. if you're manually patching the 6.x-2.11... I got the line numbers wrong above (had some debug code in)..

The correct line numbers to change are 3734 and 3740.

#4

Excellent find. I will commit the patch asap.

#5

Status:active» fixed

Committed to head

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here