Download & Extend

Clicking a link while .mp3 is loading causes problems

Project:Audio
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Colin Brumelle
Status:closed (fixed)

Issue Summary

If you click the play button on the flash player, and then click a link to another page, this happens:

1. With IE6, you get a screen full of binary characters.

2. With firefox, you get a dialog that asks if you want to download "application octect-stream" - i.e., it asks if you want to download the mp3, except the filename and .mp3 extension are absent.

This happens when the site is living on both apache/windows/php4.3 and apache/linux/php4.3, and is independent of whatever theme you are using, as far as I can tell.

The same issue is also reported by other users.

Comments

#1

Assigned to:Anonymous» Colin Brumelle

I just tested this on mac firefox/safari and win firefox/ie (connecting to a couple of different linux servers running apache2 and php4.3.11) and I was unable to reproduce this bug.

Here are the steps I followed:
I click on the flash player, and before it starts playing (while it is still loading) I click on another link on the page.
I am taken to that page without incedent.
I also tried this after the player has already started playing music, and it seemed to work fine for me here as well.

Am I missing something?

#2

I'm not sure. I thought at first it might be something I did modifying audio module, so I installed the cvs version fresh and tried again and the same thing happened. And then I changed the theme to default phptemplate/bluemarine, same thing happened.

I thought it might be the cygwin "helper apps" so I removed them and it still happened.

Someone else reproduced it, on windows xp, and I'm win2k. It occurred on both my local windows development server and on a hosted linux server.

#3

This has happens to me occasionally on win2k in firefox, but I don't exactly know why or when it happens.

#4

apache 1.3, BTW, both cases.

#5

iF YOU COMMENT OUT:

      $headers = array(
        "Pragma: public", // required
        "Expires: 0",
        "Cache-Control: must-revalidate, post-check=0, pre-check=0, private",
        "Content-Type: ". $file->filemime,
        "Content-Length: ".$file->filesize);

from function _audio_download the problem goes away. Song still plays. Maybe that should be moved into the if($attach) bit.

#6

I have always been getting this problem regardless of browser/platform.

As far as I know my host runs Apache 1.3, PHP 4.3... and my Drupal install is 4.6.3 with the latest cvs module. You can see an example here. I have installed everything correctly, or so I believe... with getid3 placed in modules/audio/getid3 and my administer > settings > audio reflects the location of my audio folder and getid3 folder correctly.

Also I can upload audio files just fine, it is just when playing I get the wierd dialog box that asks if you want to download "application octect-stream" - i.e., it asks if you want to download the mp3, except the filename and .mp3 extension are absent in both IE and Firefox in Windows, even Safari on Mac OS X and Firefox in Mac OS X. My theme is also a PHPtemplate based theme... modified interlaced. Any suggestions?

#7

replace this function, fixes it

function _audio_download($nid, $attach) {
  if ($nid) {
    $node = node_load(array('nid' => $nid));
    if (user_access('access content')) {
      $file = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid=%d", $node->audio['fid']));

      if($attach) {
         $headers = array(
        "Pragma: public", // required
        "Expires: 0",
        "Cache-Control: must-revalidate, post-check=0, pre-check=0, private",
        "Content-Type: ". $file->filemime,
        "Content-Length: ".$file->filesize);
        array_push($headers,
          "Content-Disposition: attachment; filename=\"". $file->filename ."\";",
          "Content-Transfer-Encoding: binary");
        // required for IE, otherwise Content-disposition is ignored
        if(ini_get('zlib.output_compression'))
          ini_set('zlib.output_compression', 'Off');
      } else {
        //TODO: increment the play counter
      }
      file_transfer($file->filepath, $headers);
      exit();
    }
  }
}

#8

I haven't tested it but unionweb's changes need some tweaking. If $attach is false $headers is never defined which could lead to problems. I cleaned up his fix and made a patch out of it to make it easier to review.

AttachmentSize
audio.module_unionweb_cleanup.patch 1.3 KB

#9

Status:active» fixed

wellit looks like that patch i'd rolled got committed at somepoint... i'm going to close this. feel free to reopen it if it's still occuring.

#10

Status:fixed» closed (fixed)
nobody click here