Closed Bug 309241 Opened 19 years ago Closed 19 years ago

a tmp file should be created if open an attachment of an local eml file

Categories

(Core Graveyard :: File Handling, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nian.liu, Assigned: nian.liu)

Details

Attachments

(1 file, 1 obsolete file)

see 73757

When open an attachment of an local eml file, a tmp file should be created.
Attached patch patch (obsolete) — Splinter Review
ok, I can't figure out where the multipart channel comes from here. I also don't
think that mailnews should create file URIs in the case here.

however, it probably doesn't hurt to make this code work better in this case.
How about doing this the other way round, and checking whether the channel is a
file channel, and only treating it like a local file then?
Hardware: PC → All
(In reply to comment #2)
> ok, I can't figure out where the multipart channel comes from here.
The multipart channel comes from bug#284381. To treat an attachment of an local
eml file as a local file makes that patch not work for local file.
> I also don't
> think that mailnews should create file URIs in the case here.
> 
If save a eml file to local and open it, it should be, shouldn't it?
> however, it probably doesn't hurt to make this code work better in this case.
> How about doing this the other way round, and checking whether the channel is a
> file channel, and only treating it like a local file then?

I guess a file channel doesn't help here.
hm, I see... ok...

> I guess a file channel doesn't help here.

I don't understand... your nsAttachmentChannel does not implement
nsIFileChannel. So, it seems like the code here could be something like:

 // In OnStartRequest
 nsCOMPtr<nsIFileChannel> fileChan(do_QueryInterface(aRequest));
 mIsFileChannel = fileChan != nsnull;

 // In LaunchWithApplication
 if (fileURL && mIsFileChannel) {
   // ...
 }
(In reply to comment #4)

> I don't understand... your nsAttachmentChannel does not implement
> nsIFileChannel. So, it seems like the code here could be something like:
my fault here, It should be mChannel implement nsIFileChannel when a local file
is opened, not nsAttachmentChannel.

> 
>  // In OnStartRequest
>  nsCOMPtr<nsIFileChannel> fileChan(do_QueryInterface(aRequest));
>  mIsFileChannel = fileChan != nsnull;
> 
>  // In LaunchWithApplication
>  if (fileURL && mIsFileChannel) {
>    // ...
>  }
> 

Attached patch patchv2Splinter Review
Attachment #196736 - Attachment is obsolete: true
Attachment #197131 - Flags: superreview?(cbiesinger)
Attachment #197131 - Flags: review?(cbiesinger)
Comment on attachment 197131 [details] [diff] [review]
patchv2

look good, r=biesi. but please don't move the rv declaration.

however, I'm not a super-reviewer, switching that request to bz
Attachment #197131 - Flags: superreview?(cbiesinger)
Attachment #197131 - Flags: superreview?(bzbarsky)
Attachment #197131 - Flags: review?(cbiesinger)
Attachment #197131 - Flags: review+
Comment on attachment 197131 [details] [diff] [review]
patchv2

With biesi's nit, looks great.
Attachment #197131 - Flags: superreview?(bzbarsky) → superreview+
checked in
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: