--- flashvideo.module	2009-10-21 02:05:11.000000000 +0100
+++ flashvideo-new.module	2009-12-09 15:56:35.627816330 +0000
@@ -744,7 +744,7 @@ function _flashvideo_perform_postop($old
         $cck_original_video_field_db_info = content_database_info($cck_original_video_field);
         $cck_finished_video_field_db_info = content_database_info($cck_finished_video_field);
         $cck_finished_thumbnail_field_db_info = content_database_info($cck_finished_thumbnail_field);
-        
+
         if ($create_thumbnail) { // This is for the finished thumbnail.
           // For single-upload file fields
           if ($cck_finished_thumbnail_field['db_storage'] == 1) {
@@ -1373,12 +1373,12 @@ function flashvideo_import($path, $node_
       // Create a temporary file object.
       $tempfile->filepath = $file->filename;
 
-      // Replace the covert directory with blank string so that it will move out of the convert directory.
-      $tempfile->filepath = str_replace($path .'/', '', $tempfile->filepath);
-
       // Munge up the filename for security reasons.
       $tempfile->filepath = file_munge_filename($tempfile->filepath, '');
 
+      // Replace the covert directory with blank string so that it will move out of the convert directory.
+      $tempfile->filepath = str_replace($path .'/', '', $tempfile->filepath);
+
       // Delete potential exploit files for security reasons.
       if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $tempfile->filepath)) {
         unlink(getcwd() .'/'. $tempfile->filepath);
@@ -1428,7 +1428,7 @@ function flashvideo_import($path, $node_
           $cck_original_video_field = content_fields(flashvideo_variable_get($node_type, 'cck_original_video_field', ''), $node_type);
           // Ask CCK for db info about the fields (table names and column info)
           $cck_original_video_field_db_info = content_database_info($cck_original_video_field);
-          
+
           // For single-upload file fields
           if ($cck_original_video_field['db_storage'] == 1) {
             db_query("UPDATE {". $cck_original_video_field_db_info['table'] ."} SET ". $cck_original_video_field_db_info['columns']['fid']['column'] ." = %d, ". $cck_original_video_field_db_info['columns']['list']['column'] ." = 0 WHERE nid = %d", $tempfile->fid, $node->nid);
@@ -2218,7 +2218,7 @@ function _flashvideo_replace_tags(&$node
       for ($i=2; $i<$maxi; $i=$i+2) {
         $params[$match[$i][0]] = $match[$i+1][0];
       }
-      
+
       // Set the object based on the parameters given.
       $object = ($tag == 'thumbnail') ? flashvideo_get_thumbnail($node, $params) : flashvideo_get_video($node, $params);
 
@@ -2358,34 +2358,34 @@ function flashvideo_nodeapi(&$node, $op,
         if (!module_exists('filefield') || flashvideo_variable_get(NULL, 'flashvideo_filefield', 0) == FALSE) {
           // Get the flash mime query.
           $flashmime = flashvideo_get_flash_query();
-  
+
           // Find the filepath of the first video uploaded to this node.
           $sql ="SELECT f.filepath FROM {flashvideo} fv LEFT JOIN {files} f ON f.fid = fv.fid WHERE (fv.nid = %d) AND $flashmime AND (fv.status = %d) AND (fv.video_index = 0)";
           $filepath = db_result(db_query($sql, $node->nid, FLASHVIDEO_STATUS_CONVERTED));
-  
+
           // Set the URL attributes.
           $attributes['url'] = check_url(file_create_url($filepath));
-  
+
           // Get the filesize and set that in the attributes.
           $attributes['length'] = filesize(getcwd() .'/'. $filepath);
-  
+
           // Get the mime type of this video.
           $mime_type = _flashvideo_get_mime_type($filepath);
-  
+
           // If the mime type was found, then set the attributes.
           if ($mime_type) {
             $attributes['type'] = $mime_type;
           }
-  
+
           // Set the URL for the media object.
           $media['url'] = $attributes['url'];
-  
+
           // Set the filesize for the media object.
           $media['fileSize'] = $attributes['length'];
-  
+
           // Set the mime type for the media attribute.
           $media['type'] = $attributes['type'];
-  
+
           // Return an array of what to contribute to this RSS feed.
           return array(array('key' => 'enclosure', 'attributes' => $attributes), array('key' => 'media', 'value' => '', 'attributes' => $media));
         }
@@ -2540,4 +2540,4 @@ function _flashvideo_load($node) {
     $files[$file->fid] = $file;
   }
   return $files;
-}
\ No newline at end of file
+}
