Last Comment Bug 308326 - Cannot open detached file from the message if its filename or pathname contains Japanese character
: Cannot open detached file from the message if its filename or pathname contai...
Status: VERIFIED FIXED
: fixed1.8, intl
Product: MailNews Core
Classification: Components
Component: Internationalization (show other bugs)
: Trunk
: x86 Windows XP
: -- major (vote)
: mozilla1.8beta5
Assigned To: Masayuki Nakano [:masayuki] (Mozilla Japan)
:
:
Mentors:
Depends on: 309335
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-13 06:59 PDT by u69748
Modified: 2008-07-31 01:22 PDT (History)
2 users (show)
mscott: blocking1.8b5+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
sample mbox (3.30 KB, text/plain)
2005-09-13 07:07 PDT, u69748
no flags Details
fix for problem noticing that detach failed. (2.61 KB, patch)
2005-09-13 13:13 PDT, David :Bienvenu
mscott: superreview+
mscott: approval1.8b5+
Details | Diff | Splinter Review
Patch rv1.0 (54.89 KB, patch)
2005-09-19 13:29 PDT, Masayuki Nakano [:masayuki] (Mozilla Japan)
no flags Details | Diff | Splinter Review
Patch rv1.0 (2.40 KB, patch)
2005-09-19 13:32 PDT, Masayuki Nakano [:masayuki] (Mozilla Japan)
masayuki: review+
mscott: superreview+
mscott: approval1.8b5+
Details | Diff | Splinter Review

Description u69748 2005-09-13 06:59:16 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050907 (No IDN) Firefox/1.4
Build Identifier: Thumderbird 1.5 beta 1

Cannot open detached file from the message if its filename or pathname contains
Japanese character.


Reproducible: Always

Steps to Reproduce:
1.Crate message with attachment which filename contains Japanese character.
2.Detach the attachment.
3.Double click the attachment.

Actual Results:  
Nothing happens.

Expected Results:  
Detached file should be opend.
Comment 1 u69748 2005-09-13 07:07:19 PDT
Created attachment 195866 [details]
sample mbox

This contains 3 messages
1: Original mesage with a attachment which filename contains Japanese
(¥Æ¥¹¥È.txt).
2: Attachment is detached to C:/
3: Attachment is detached to
C:/Documents%20and%20Settings/level/%83f%83X%83N%83g%83b%83v/
   (in Japanese: C:/Documents%20and%20Settings/level/¥Ç¥¹¥¯¥È¥Ã¥×/ )
Comment 2 u69748 2005-09-13 07:11:46 PDT
In Japanese environment, detach can not be used because of this bug.
Comment 3 Asa Dotzler [:asa] 2005-09-13 09:27:43 PDT
Scott, this seems like a pretty big failure in a new feature. Will you guys have
time to look into this for 1.5 b2?
Comment 4 Scott MacGregor 2005-09-13 09:29:10 PDT
yes we should fix this
Comment 5 David :Bienvenu 2005-09-13 13:13:47 PDT
Created attachment 195929 [details] [diff] [review]
fix for problem noticing that detach failed.

I had a problem even detaching the attachment in the provided test case, so
I've fixed that handling of that error.  I think the filename was what caused
the problem detaching.

I'm not convinced the problem reported has to do with filenames - it could just
have to do with that we've left the content type as base64 encoded, when it's
not, since we decode when we do a save as.
Comment 6 David :Bienvenu 2005-09-13 13:14:21 PDT
see bug 308321 for the encoding issue.
Comment 7 David :Bienvenu 2005-09-14 09:35:33 PDT
Hideyuki, can you try with tomorrow's build, and see if it was the content
transfer encoding that caused the problem? I can't test with japanese characters
here...
Comment 8 u69748 2005-09-15 08:53:37 PDT
I have tried with 1.5 Beta 1 (20050915).

The problem is not fixed.
Detached part is following.

--------------020503070406020209030308
Content-Type: text/plain;
 name*=ISO-2022-JP''%1B%24B%25F%259%25H%1B%28B.txt
Content-Disposition: attachment; filename="���������.txt"
X-Mozilla-External-Attachment-URL:
file:///C:/Documents%20and%20Settings/level/%83f%83X%83N%83g%83b%83v/%83e%83X%83g.txt
X-Mozilla-Altered: AttachmentDetached; date="Fri Sep 16 00:40:14 2005"

The original MIME headers for this attachment are:
Content-Type: text/plain;
 name*=ISO-2022-JP''%1B%24B%25F%259%25H%1B%28B.txt
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename*=ISO-2022-JP''%1B%24B%25F%259%25H%1B%28B.txt


--------------020503070406020209030308--

Still I cannot open the file.
And error page says:

File Not Found
The file /C:/Documents and Settings/level/ƒfƒXƒNƒgƒbƒv/ƒeƒXƒg.txt cannot be
found. Please check the location and try again.

BTW, I think this error page is not suitable for this case.
Comment 9 u69748 2005-09-15 09:07:19 PDT
(In reply to comment #8)
> X-Mozilla-External-Attachment-URL:
>
file:///C:/Documents%20and%20Settings/level/%83f%83X%83N%83g%83b%83v/%83e%83X%83g.txt

Firefox can open the detached file by this URL.
Comment 10 David :Bienvenu 2005-09-15 21:56:10 PDT
Jungshik, any ideas about this? Presumably it's a filename escaping problem...
Comment 11 Masayuki Nakano [:masayuki] (Mozilla Japan) 2005-09-18 23:11:46 PDT
I think that this is a bug.

nsMessenger::OpenURL
> 586   else
> 587   {
> 588     nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
> 589     if(webNav)
> 590       rv = webNav->LoadURI(NS_ConvertASCIItoUCS2(unescapedUrl).get(), //
URI string
> 591       nsIWebNavigation::LOAD_FLAGS_IS_LINK, // Load flags
> 592       nsnull,                               // Referring URI
> 593       nsnull,                               // Post stream
> 594       nsnull);                              // Extra headers
> 595   }

I will test tonight or later.
# working on other bugs now...
Comment 12 Masayuki Nakano [:masayuki] (Mozilla Japan) 2005-09-18 23:19:11 PDT
Previous comment is here:
http://lxr.mozilla.org/mozilla/source/mailnews/base/src/nsMessenger.cpp#562

And called by here:
http://lxr.mozilla.org/mozilla/source/mail/base/content/msgHdrViewOverlay.js#1147
Comment 13 Masayuki Nakano [:masayuki] (Mozilla Japan) 2005-09-19 13:29:16 PDT
Created attachment 196690 [details] [diff] [review]
Patch rv1.0
Comment 14 Masayuki Nakano [:masayuki] (Mozilla Japan) 2005-09-19 13:32:30 PDT
Created attachment 196691 [details] [diff] [review]
Patch rv1.0

I think that we don't need to unescape the URL for nsIWebNavigation::LoadURI.
This patch makes to open the detached file. But the description is broken. This
is another bug.
Comment 15 Mike Connor [:mconnor] 2005-09-19 13:34:03 PDT
Comment on attachment 196691 [details] [diff] [review]
Patch rv1.0

sorry, I'm not a mailnews peer, try bienvenu or mscott
Comment 16 Masayuki Nakano [:masayuki] (Mozilla Japan) 2005-09-19 13:36:03 PDT
Junkshik:

If you have a time, please look the patch.
Comment 17 David :Bienvenu 2005-09-19 14:13:25 PDT
Comment on attachment 196691 [details] [diff] [review]
Patch rv1.0

I tried this on imap and pop3, and it worked fine on my test cases. Thx for the
patch! Scott, do you have some interesting test cases for this?
Comment 18 Masayuki Nakano [:masayuki] (Mozilla Japan) 2005-09-19 15:42:01 PDT
Comment on attachment 196691 [details] [diff] [review]
Patch rv1.0

Oops. review flag is gone by changing product.

r=bienvenu
Comment 19 Scott MacGregor 2005-09-22 09:25:37 PDT
Comment on attachment 196691 [details] [diff] [review]
Patch rv1.0

I'm not a huge fan of adding the early returns to the code, I thought the old
organization was better. But using ConvertASCIItoUTF16 looks good to me. 

approving for the branch too.
Comment 20 Masayuki Nakano [:masayuki] (Mozilla Japan) 2005-09-22 09:39:11 PDT
checked-in to trunk and 1.8branch.
Comment 21 u69748 2005-09-23 18:36:39 PDT
Windows XP, version 1.5 Beta 1 (20050922)
I have comfirmed the fix of this bug.
Thanx!

Note You need to log in before you can comment on or make changes to this bug.