[dokuwiki] Re: AW: Re: Error downloading with darcs and one question

  • From: Christopher Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 2 Mar 2008 14:27:39 +0000


On 2 Mar 2008, at 13:20, Sebastian Wienecke wrote:

Thanks,

@Bob:
but then ALL pdfs from ALL sites will be downloaded to temporary directory and then opened. With Adobe reader, and not with the plugin. So it's not the
same.

@Chris:
I know how it works :-) I want to know how I can change this :-) The
dokuwiki is only in our intranet, so the change of an attack is unbelievable
low :-)

Sebastian


Ask the right question and get the right answer ;)

There is no cofigurable option within DW to change the behaviour I described. However, you can edit lib/exe/fetch.php to change what happens. The code concerned is around line 112 in my version of the file ...

  //application mime type is downloadable
  if(substr($mime,0,11) == 'application'){
header('Content-Disposition: attachment; filename="'.basename($file).'";');
  }


To have the browser attempt to deal directly with the content replace "attachment" with "inline" for whichever mime types you want. e.g.

  //application mime type is downloadable
  if(substr($mime,0,11) == 'application'){
$disposition = in_array(substr($mime,12), $config['inline_mimetypes']) ? 'inline' : 'attachment'; header('Content-Disposition: '.$disposition.'; filename="'.basename($file).'";');
  }


and add the following to config.local.protected

$config['inline_mimetypes'] = array('pdf','msword');

above code has not been tested, but you should get the idea.

- Chris

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: