settings.preserve_relative_urls set to false causes settings.button_image_url to have a value even if set to ""

force2000 - October 13, 2009 - 21:34
Project:SWFUpload
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

NOTE: The version is 2.2.0.1 as downloaded from http://code.google.com/p/swfupload/.

In the swfupload.js file, when "this.settings.preserve_relative_urls" is set to "false" the following code is executed in "SWFUpload.prototype.initSettings = function ()":

if (!this.settings.preserve_relative_urls) {
//this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it
this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
}

However, if "this.settings.button_image_url" was set to "" (to use an overlay instead of an image) its value becomes the root of the executed script which causes that root to be loaded later on when trying to get the image. Resulting in a full page load for absolutly no reason.

I replaced some code with this within the previous snippet to correct the problem:

if (this.settings.button_image_url != "") {
this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
}

 
 

Drupal is a registered trademark of Dries Buytaert.