Bug 53009

Summary: add --mimetype command line parameter
Product: [Applications] kmail Reporter: Aaron Williams <aaronw>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Solaris   
Latest Commit: Version Fixed In:

Description Aaron Williams 2003-01-15 02:28:49 UTC
Version:           unknown (using KDE 3.1.0 (RC6))
Installed from:    compiled sources
Compiler:          gcc version 2.95.3 20010315 (release)
OS:          SunOS (sun4u) release 5.7

When I mail a web page to someone using Location->Send File in Konqueror the mime type of the document always defaults to Unknown application/octet-stream. The web page being mailed should inherit the mime type in Konqueror, in this case text/html. The same thing happens if I try and send a JPEG file, instead of image/jpeg the mime type is Unknown application/octet-stream. 
 
This has been a problem since 3.0.x and continues through 3.1rc6.

I found that the problem appears to be in kmail when using --attach <url> option that the mime type returned by the web server is not preserved.  Even if no mime type is available from the server, standard filename extensions should map to a mime type (i.e. *.jpg = image/jpeg).

I previously submitted this bug as bug 53008 under Konqueror, but it should fall under kmail.
Comment 1 Aaron Williams 2003-06-14 05:08:45 UTC
This problem remains in 3.1.1.  I have not seen this problem on my SuSE Linux setup at 
home so it may only be appearing on Solaris and/or Sparc. 
 
 
Comment 2 Ingo Klöcker 2003-06-14 16:31:55 UTC
Subject: Re:  kmail --attach <url> does not preserve mime type in attachment

KMail determines the mime type with
  KMimeType::findByURL(aUrl, 0, aUrl.isLocalFile())

But for http://-URLs KMimeType::findByURL always returns 
application/octet-stream as mime type. (The API documentation of 
KMimeType::findByURL says "If that does not help it looks at the 
extension. This is fine for FTP, FILE, TAR and friends, but is not for 
HTTP ( cgi scripts! ).".)

If you want to change this then patch your http.procotol. For example by 
changing
  defaultMimetype=application/octet-stream
  determineMimetypeFromExtension=false
to
  defaultMimetype=text/html
  determineMimetypeFromExtension=true

I agree that it would be ideal if Konqueror somehow passed the mime type 
to KMail if the mime type is already known. But this can't be changed 
before KDE 3.2.

Comment 3 Ingo Klöcker 2003-06-14 16:46:41 UTC
I converted your bug report to a wish. 
Comment 4 Ingo Klöcker 2003-06-15 22:32:48 UTC
Subject: Re:  New: kmail --attach <url> does not preserve mime type in attachment

This bug was easier to fix than I thought. It will be fixed in KMail 
1.5.3.