Closed Bug 245698 Opened 21 years ago Closed 4 years ago

attaching bmp files from mac doesn't work like windows

Categories

(MailNews Core :: Composition, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: sspitzer, Unassigned)

Details

Content-Type: image/bmp; name="beach.bmp" attaching bmp files from mac doesn't work like windows Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="beach.bmp" when I do the same thing from mac, I get: Content-Type: application/octet-stream; x-mac-type="0"; x-mac-creator="0"; name="beach.bmp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="beach.bmp" when I try the same thing with a gif, I get this: trying the same thing, but attaching a .gif, here's what I get: Content-Type: image/gif; x-mac-type="0"; x-mac-creator="0"; name="mlogo.gif" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="mlogo.gif" So I think maybe the problem is that on attach, we aren't recognizing what a .bmp file is.
ok, we appear to be getting this mime type from the os. see http://lxr.mozilla.org/mozilla/source/uriloader/exthandler/mac/nsOSHelperAppService.cpp#263 I'll attach a stack.
for a stack to where we ask the the os what "bmp" might be: #0 nsOSHelperAppService::GetMIMEInfoFromOS(char const*, char const*, int*) (this=0x1138e00, aMIMEType=0x0, aFileExt=0xbfffb408 "bmp", aFound=0xbfffb0a0) at mac/nsOSHelperAppService.cpp:260 #1 0x09c72234 in nsExternalHelperAppService::GetFromTypeAndExtension(char const*, char const*, nsIMIMEInfo**) (this=0x1138e00, aMIMEType=0x0, aFileExt=0xbfffb408 "bmp", _retval=0xbfffb1c0) at nsExternalHelperAppService.cpp:2232 #2 0x09c77b34 in nsOSHelperAppService::GetFromTypeAndExtension(char const*, char const*, nsIMIMEInfo**) (this=0x1138e00, aType=0x0, aFileExt=0xbfffb408 "bmp", aMIMEInfo=0xbfffb1c0) at mac/nsOSHelperAppService.cpp:182 #3 0x09c72964 in nsExternalHelperAppService::GetTypeFromExtension(char const*, char**) (this=0x1138e00, aFileExt=0xbfffb408 "bmp", aContentType=0x2100dba4) at nsExternalHelperAppService.cpp:2330 #4 0x224b48f8 in nsMsgComposeAndSend::AddCompFieldLocalAttachments() (this=0x1effd0a0) at nsMsgSend.cpp:2306 #5 0x224b5798 in nsMsgComposeAndSend::HackAttachments(nsMsgAttachmentData const*, nsMsgAttachedFile const*) (this=0x1effd0a0, attachments=0x0, preloaded_attachments=0x0) at nsMsgSend.cpp:2514 #6 0x224b89f4 in nsMsgComposeAndSend::Init(nsIMsgIdentity*, char const*, nsMsgCompFields*, nsFileSpec*, int, int, int, nsIMsgDBHdr*, char const*, char const*, unsigned, nsMsgAttachmentData const*, nsMsgAttachedFile const*, char const*) (this=0x1effd0a0, aUserIdentity=0x1054e2e0, aAccountKey=0x21006580 "account1", fields=0x10598d60, sendFileSpec=0x0, digest_p=0, dont_deliver_p=0, mode=4, msgToReplace=0x0, attachment1 [details] [diff] [review]_type=0x225364d8 "text/html", attachment1 [details] [diff] [review]_body=0x0, attachment1 [details] [diff] [review]_body_length=0, attachments=0x0, preloaded_attachments=0x0, password=0x11085bd8 "") at nsMsgSend.cpp:3222 #7 0x224bc22c in nsMsgComposeAndSend::CreateAndSendMessage(nsIEditor*, nsIMsgIdentity*, char const*, nsIMsgCompFields*, int, int, int, nsIMsgDBHdr*, char const*, char const*, unsigned, nsMsgAttachmentData const*, nsMsgAttachedFile const*, void*, nsIDOMWindowInternal*, nsIMsgProgress*, nsIMsgSendListener*, char const*) (this=0x1effd0a0, aEditor=0x2c64400, aUserIdentity=0x1054e2e0, aAccountKey=0x21006580 "account1", fields=0x10598d60, digest_p=0, dont_deliver_p=0, mode=4, msgToReplace=0x0, attachment1 [details] [diff] [review]_type=0x225364d8 "text/html", attachment1 [details] [diff] [review]_body=0x0, attachment1 [details] [diff] [review]_body_length=0, attachments=0x0, preloaded_attachments=0x0, relatedPart=0x0, parentWindow=0x1058c6f4, progress=0x21005c30, aListener=0x1efda394, password=0x11085bd8 "") at nsMsgSend.cpp:4034 #8 0x224ed6e8 in nsMsgCompose::_SendMsg(int, nsIMsgIdentity*, char const*, int) (this=0x11085af0, deliverMode=4, identity=0x1054e2e0, accountKey=0x21006580 "account1", entityConversionDone=0) at nsMsgCompose.cpp:934 #9 0x224ee4dc in nsMsgCompose::SendMsg(int, nsIMsgIdentity*, char const*, nsIMsgWindow*, nsIMsgProgress*) (this=0x11085af0, deliverMode=4, identity=0x1054e2e0, accountKey=0x21006580 "account1", aMsgWindow=0x10e3aed0, progress=0x21005c30) at nsMsgCompose.cpp:1115 #10 0x01c498f4 in _XPTC_InvokeByIndex () at nsTObsoleteAStringThunk.cpp:51 #11 0x01c48c2c in XPTC_InvokeByIndex (that=0x11085af0, methodIndex=7, paramCount=5, params=0xbfffbe60) at xptcinvoke_ppc_rhapsody.cpp:144 #12 0x039503fc in XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) (ccx=@0xbfffc100, mode=CALL_METHOD) at xpcwrappednative.cpp:2026 #13 0x039596c8 in XPC_WN_CallMethod(JSContext*, JSObject*, unsigned, long*, long*) (cx=0x1058c8c0, obj=0x2b96bd8, argc=5, argv=0x2d078c0, vp=0xbfffc210) at xpcwrappednativejsops.cpp:1287 #14 0x00567ab0 in js_Invoke (cx=0x1058c8c0, argc=5, flags=0) at jsinterp.c:941 #15 0x005782b8 in js_Interpret (cx=0x1058c8c0, result=0xbfffc8d0) at jsinterp.c:2967 #16 0x00567b34 in js_Invoke (cx=0x1058c8c0, argc=1, flags=2) at jsinterp.c:958 #17 0x03949b14 in nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS*, unsigned short, nsXPTMethodInfo const*, nsXPTCMiniVariant*) (this=0xf4cdf80, wrapper=0x11081c90, methodIndex=5, info=0x28add10, nativeParams=0xbfffcce0) at xpcwrappedjsclass.cpp:1336 #18 0x03942040 in nsXPCWrappedJS::CallMethod(unsigned short, nsXPTMethodInfo const*, nsXPTCMiniVariant*) (this=0x11081c90, methodIndex=5, info=0x28add10, params=0xbfffcce0) at xpcwrappedjs.cpp:449 #19 0x01c495cc in PrepareAndDispatch (self=0x11081c90, methodIndex=5, args=0xbfffcea8, gprData=0xbfffcdec, fprData=0xbfffce08) at xptcstubs_ppc_rhapsody.cpp:234 #20 0x01c4a134 in SharedStub () at nsTObsoleteAStringThunk.cpp:51 #21 0x01c498f4 in _XPTC_InvokeByIndex () at nsTObsoleteAStringThunk.cpp:51 #22 0x01c48c2c in XPTC_InvokeByIndex (that=0x11081c90, methodIndex=5, paramCount=1, params=0xbfffcfd0) at xptcinvoke_ppc_rhapsody.cpp:144 #23 0x039503fc in XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) (ccx=@0xbfffd270, mode=CALL_METHOD) at xpcwrappednative.cpp:2026 #24 0x039596c8 in XPC_WN_CallMethod(JSContext*, JSObject*, unsigned, long*, long*) (cx=0x1058c8c0, obj=0x2badec0, argc=1, argv=0x2d076c0, vp=0xbfffd380) at xpcwrappednativejsops.cpp:1287 #25 0x00567ab0 in js_Invoke (cx=0x1058c8c0, argc=1, flags=0) at jsinterp.c:941 #26 0x005782b8 in js_Interpret (cx=0x1058c8c0, result=0xbfffda40) at jsinterp.c:2967 #27 0x00567b34 in js_Invoke (cx=0x1058c8c0, argc=1, flags=2) at jsinterp.c:958 #28 0x00567f48 in js_InternalInvoke (cx=0x1058c8c0, obj=0x2bc5f90, fval=45899680, flags=0, argc=1, argv=0xbfffdd24, rval=0xbfffde78) at jsinterp.c:1035 #29 0x00525014 in JS_CallFunctionValue (cx=0x1058c8c0, obj=0x2bc5f90, fval=45899680, argc=1, argv=0xbfffdd24, rval=0xbfffde78) at jsapi.c:3607 #30 0x12ceaca8 in nsJSContext::CallEventHandler(JSObject*, JSObject*, unsigned, long*, long*) (this=0x1058c850, aTarget=0x2bc5f90, aHandler=0x2bc5fa0, argc=1, argv=0xbfffdd24, rval=0xbfffde78) at nsJSEnvironment.cpp:1296 #31 0x12d3f7f8 in nsJSEventListener::HandleEvent(nsIDOMEvent*) (this=0x10e4e410, aEvent=0x2102a998) at nsJSEventListener.cpp:174 #32 0x12b35adc in nsEventListenerManager::HandleEventSubType(nsListenerStruct*, nsIDOMEvent*, nsIDOMEventTarget*, unsigned, unsigned) (this=0x10e4e3e0, aListenerStruct=0x10e4e460, aDOMEvent=0x2102a998, aCurrentTarget=0x2102a120, aSubType=8, aPhaseFlags=7) at nsEventListenerManager.cpp:1434 #33 0x12b35fac in nsEventListenerManager::HandleEvent(nsIPresContext*, nsEvent*, nsIDOMEvent**, nsIDOMEventTarget*, unsigned, nsEventStatus*) (this=0x10e4e3e0, aPresContext=0x2babc00, aEvent=0xbfffe970, aDOMEvent=0xbfffe160, aCurrentTarget=0x2102a120, aFlags=7, aEventStatus=0xbfffe960) at nsEventListenerManager.cpp:1525 #34 0x12d74b54 in nsXULElement::HandleDOMEvent(nsIPresContext*, nsEvent*, nsIDOMEvent**, unsigned, nsEventStatus*) (this=0x10e4e3a0, aPresContext=0x2babc00, aEvent=0xbfffe970, aDOMEvent=0xbfffe160, aFlags=7, aEventStatus=0xbfffe960) at nsXULElement.cpp:2840 #35 0x12d73b40 in nsXULElement::HandleDOMEvent(nsIPresContext*, nsEvent*, nsIDOMEvent**, unsigned, nsEventStatus*) (this=0x1102f860, aPresContext=0x2babc00, aEvent=0xbfffe970, aDOMEvent=0x0, aFlags=1, aEventStatus=0xbfffe960) at nsXULElement.cpp:2673 #36 0x128f0554 in PresShell::HandleDOMEventWithTarget(nsIContent*, nsEvent*, nsEventStatus*) (this=0x2b98600, aTargetContent=0x1102f860, aEvent=0xbfffe970, aStatus=0xbfffe960) at nsPresShell.cpp:6112 #37 0x129e78b0 in nsButtonBoxFrame::MouseClicked(nsIPresContext*, nsGUIEvent*) (this=0x2bf05c4, aPresContext=0x2babc00, aEvent=0xbfffebd0) at nsButtonBoxFrame.cpp:175 #38 0x129e7718 in nsButtonBoxFrame::HandleEvent(nsIPresContext*, nsGUIEvent*, nsEventStatus*) (this=0x2bf05c4, aPresContext=0x2babc00, aEvent=0xbfffebd0, aEventStatus=0xbffff1f4) at nsButtonBoxFrame.cpp:146 #39 0x128f0378 in PresShell::HandleEventInternal(nsEvent*, nsIView*, unsigned, nsEventStatus*) (this=0x2b98600, aEvent=0xbfffebd0, aView=0x0, aFlags=1, aStatus=0xbffff1f4) at nsPresShell.cpp:6079 #40 0x128efd4c in PresShell::HandleEventWithTarget(nsEvent*, nsIFrame*, nsIContent*, unsigned, nsEventStatus*) (this=0x2b98600, aEvent=0xbfffebd0, aFrame=0x2bf05c4, aContent=0x1102f860, aFlags=1, aStatus=0xbffff1f4) at nsPresShell.cpp:5991 #41 0x12b41a10 in nsEventStateManager::CheckForAndDispatchClick(nsIPresContext*, nsMouseEvent*, nsEventStatus*) (this=0x10e29f60, aPresContext=0x2babc00, aEvent=0xbffff590, aStatus=0xbffff1f4) at nsEventStateManager.cpp:2904 #42 0x12b3ef14 in nsEventStateManager::PostHandleEvent(nsIPresContext*, nsEvent*, nsIFrame*, nsEventStatus*, nsIView*) (this=0x10e29f60, aPresContext=0x2babc00, aEvent=0xbffff590, aTargetFrame=0x2bf05c4, aStatus=0xbffff1f4, aView=0x10e2a1f0) at nsEventStateManager.cpp:1905 #43 0x128f0438 in PresShell::HandleEventInternal(nsEvent*, nsIView*, unsigned, nsEventStatus*) (this=0x2b98600, aEvent=0xbffff590, aView=0x10e2a1f0, aFlags=1, aStatus=0xbffff1f4) at nsPresShell.cpp:6087 #44 0x128ef9c8 in PresShell::HandleEvent(nsIView*, nsGUIEvent*, nsEventStatus*, int, int&) (this=0x2b98600, aView=0x10e2a1f0, aEvent=0xbffff590, aEventStatus=0xbffff1f4, aForceHandle=1, aHandled=@0xbffff264) at nsPresShell.cpp:5928 #45 0x12cde2f4 in nsViewManager::HandleEvent(nsView*, nsGUIEvent*, int) (this=0x10e2a090, aView=0x10e2a1f0, aEvent=0xbffff590, aCaptured=1) at nsViewManager.cpp:2283 #46 0x12cdd6e0 in nsViewManager::DispatchEvent(nsGUIEvent*, nsEventStatus*) (this=0x10e2a090, aEvent=0xbffff590, aStatus=0xbffff3e0) at nsViewManager.cpp:2025 #47 0x12cd1d2c in HandleEvent(nsGUIEvent*) (aEvent=0xbffff590) at nsView.cpp:76 #48 0x08bc5c6c in nsWindow::DispatchEvent(nsGUIEvent*, nsEventStatus&) (this=0x10e2a250, event=0xbffff590, aStatus=@0xbffff4a0) at nsWindow.cpp:2024 #49 0x08bc5d64 in nsWindow::DispatchWindowEvent(nsGUIEvent&) (this=0x10e2a250, event=@0xbffff590) at nsWindow.cpp:2039 #50 0x08bc5eac in nsWindow::DispatchMouseEvent(nsMouseEvent&) (this=0x10e2a250, aEvent=@0xbffff590) at nsWindow.cpp:2065 #51 0x08b9f218 in nsMacEventHandler::HandleMouseUpEvent(EventRecord&) (this=0x10599010, aOSEvent=@0xbffff840) at nsMacEventHandler.cpp:1677 #52 0x08b9c760 in nsMacEventHandler::HandleOSEvent(EventRecord&) (this=0x10599010, aOSEvent=@0xbffff840) at nsMacEventHandler.cpp:523 #53 0x08baa0c0 in nsMacWindow::DispatchEvent(void*, int*) (this=0x10599420, anEvent=0xbffff840, _retval=0xbffff6f0) at nsMacWindow.cpp:1714 #54 0x08ba3300 in nsMacMessagePump::DispatchOSEventToRaptor(EventRecord&, OpaqueWindowPtr*) (this=0x11335e0, anEvent=@0xbffff840, aWindow=0x1059a840) at nsMacMessagePump.cpp:1041 #55 0x08ba2e3c in nsMacMessagePump::DoMouseUp(EventRecord&) (this=0x11335e0, anEvent=@0xbffff840) at nsMacMessagePump.cpp:819 #56 0x08ba1f74 in nsMacMessagePump::DispatchEvent(int, EventRecord*) (this=0x11335e0, aRealEvent=1, anEvent=0xbffff840) at nsMacMessagePump.cpp:446 #57 0x08ba1cb0 in nsMacMessagePump::DoMessagePump() (this=0x11335e0) at nsMacMessagePump.cpp:312 #58 0x08b8cd64 in nsAppShell::Run() (this=0x1133400) at nsAppShell.cpp:112 #59 0x06d3ec0c in nsAppShellService::Run() (this=0x1133190) at nsAppShellService.cpp:523 #60 0x000064a0 in main1(int, char**, nsISupports*) (argc=4, argv=0xbffffca8, nativeApp=0x110f870) at nsAppRunner.cpp:1303 #61 0x00006c88 in main (argc=4, argv=0xbffffca8) at nsAppRunner.cpp:1780
note, if the OS service had not found "bmp", I think we would have fallen through to this code: http://lxr.mozilla.org/mozilla/source/uriloader/exthandler/nsExternalHelperAppService.cpp#2289 which would have looked at the array of extraMimeEntries, including { IMAGE_BMP, "bmp", "BMP Image", 0, 0 } which is how this might have worked in previous version of mozilla.
Status: NEW → ASSIGNED
I'm going to go out on a limb and point a finger, my apologies if I'm way off. I think at some point (after 1.4) things were changed so that we stopped guessing content type by extension, or maybe that'd we do so more safely. but, when attaching files to send, we sort of want this extra clever guessing code. maybe the right fix is: in mailnews, after calling mimeFinder->GetTypeFromExtension(), if we still think it is "application/octet-stream" try calling GetMIMEInfoForExtensionFromExtras() directly (note, not currently exposed via an interface) and if that returns something, use it. this wouldn't open any previously closed holes on receiving mail or loading links, but would fix this bug. darin / cbiesinger / boris, comments?
> in mailnews, after calling mimeFinder->GetTypeFromExtension(), if we still think to be specifc, I mean in nsMsgComposeAndSend::AddCompFieldLocalAttachments() there are other places in mailnews where we would not want to do this. but in composing emails, we could.
Ccing myself since this bugzilla bug is related to partner project bug240: http://partner-projects.mozilla.org/show_bug.cgi?id=240
> in mailnews, after calling mimeFinder->GetTypeFromExtension(), if we still > think it is "application/octet-stream" try calling > GetMIMEInfoForExtensionFromExtras() GetTypeFromExtension calls GetMIMEInfoForExtensionFromExtras, no? I don't think we want to be overriding the OS setting for a type with the "extras" setting if an OS setting exists. If it doesn't exist, we should be falling back on extras.
> I don't think we want to be overriding the OS setting for a type with the > "extras" setting if an OS setting exists. If it doesn't exist, we should be > falling back on extras. I'll continue to debug to see if the OS is telling us that bmp's are "application/octet-stream" or if the OS tells us it doesn't know, and our code assumes "application/octet-stream".
Product: MailNews → Core
sorry for the spam. making bugzilla reflect reality as I'm not working on these bugs. filter on FOOBARCHEESE to remove these in bulk.
Assignee: sspitzer → nobody
Status: ASSIGNED → NEW
QA Contact: composition
Product: Core → MailNews Core

I think this is now WFM. Attaching bmp on Mac I see

Content-Type: image/bmp; x-mac-type="0"; x-mac-creator="0";
name="Untitled.bmp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Untitled.bmp"

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.