--- swftools_old.module	2010-08-31 18:28:33.000000000 +0100
+++ swftools.module	2010-08-31 18:34:41.000000000 +0100
@@ -1768,6 +1768,9 @@ function swftools_create_url($path) {
  */
 function swftools_get_url_and_path($file) {
 
+  $filepath = parse_url($file, PHP_URL_PATH);
+  $fileurl = str_replace($filepath, drupal_urlencode($filepath), $file);
+
   // src will contain a full, or relative, url that is used to render the file
   // src_path will contain a partial path (without webroot), or the original file path
   $ret = array(
@@ -1776,7 +1779,7 @@ function swftools_get_url_and_path($file
   );
   
   // If already a valid absolute url simply return it
-  if (valid_url($file, TRUE)) {
+  if (valid_url($fileurl, TRUE)) {
     $ret['fileurl'] = $file;
     return $ret;
   }
@@ -1784,10 +1787,10 @@ function swftools_get_url_and_path($file
   // If a valid url, and starts with /, then assume to be a local path relative to web root
   // No security check is needed as the result of this is only output to the webpage
   // We strip base_path from the file to create filepath that is valid for image_get_info later.
-  if (valid_url($file) && strpos($file, '/') === 0) {
+  if (valid_url($fileurl) && strpos($file, '/') === 0) {
     return array(
       'fileurl' => $file,
-      'filepath' => str_replace(base_path(), '', $file),
+      'filepath' => base_path() == '/' ? substr($file,1) : str_replace(base_path(), '', $file),
     );
   }
   
@@ -2322,7 +2325,7 @@ function swftools_form_system_performanc
  * @return
  *   An HTML string that generates the output
  */
-function theme_swftools_embed(&$options) {
+function theme_swftools_embed($options) {
   
   // Call the specific embedding function - this generates the mark to render the swf
   // The default is a theme with the same name as the method, but this can be over-ridden by modifying the theme key
