Re: elinks: mime-type changes
Witold Filipczyk <[email protected]>
| Newsgroups | gmane.comp.web.elinks.user |
|---|---|
| Message-ID | <20080408193115.GA16309@pldmachine> |
On Tue, Apr 08, 2008 at 02:14:39PM +0200, [email protected] wrote: > Hello, > > > I generate for a site via fpdf (script-name: druck.php) a druck.pdf - with mime-type "application/pdf" in his header (please see http://www.werkleitz.de/~ub -> impressum -> Druckversion) and the most browser accept this. > > Except elinks: there comes a window with: "What to do?" and "What would you like to do with the file 'druck.pdf' (type: application/pdf)?", with input-field "kpdf %" and "open, save, display, show header, cancel". If I now use "save" so it saves the file as druck.pdf and after this I can open it as a pdf-file. But if I choose "open", so I get the following error-message in kpdf: "Could not open file:///tmp/elinkcoHwSL.php" and in elinks "kpdf: Warning: Unknown mimetype 'application/x-php'". > > Why elinks changed the mime-type and the file-ending back to .php? And how can I say elinks to do the right? Or is it maybe a bug? It's a bug in ELinks. Here is a patch. I'm not sure if the patch is always correct, but works in this case. -- Witek diff --git a/src/session/download.c b/src/session/download.c index e2b5d70..58ae1df 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -751,7 +751,9 @@ static unsigned char * get_temp_name(struct uri *uri) { struct string name; +#if 0 unsigned char *extension; +#endif /* FIXME * We use tempnam() here, which is unsafe (race condition), for now. * This should be changed at some time, but it needs an in-depth work @@ -768,12 +770,14 @@ get_temp_name(struct uri *uri) add_to_string(&name, nm); free(nm); + add_mime_filename_to_string(&name, uri); +#if 0 extension = get_extension_from_uri(uri); if (extension) { add_shell_safe_to_string(&name, extension, strlen(extension)); mem_free(extension); } - +#endif return name.source; } _______________________________________________ elinks-users mailing list [email protected] http://linuxfromscratch.org/mailman/listinfo/elinks-users