Closed Bug 98576 Opened 23 years ago Closed 21 years ago

IMAP: 'Save as Draft' doesn't save the message. (if URI contains a space)

Categories

(MailNews Core :: Networking: IMAP, defect)

x86
Windows 2000
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: skasinathan, Assigned: Bienvenu)

Details

(Keywords: dataloss)

Attachments

(2 files, 1 obsolete file)

allright, I have seen this bug several times when I really want to save a msg as
draft. But when I try to reproduce this, I couldn't duplicate this. I'm gonna
file this bug and let's see if anyone can duplicate consistently. :)

All I did was compose a msg (with mutiple recepients) and did File | Save as |
Draft. I couldn't see that msg in my drafts folder. I'm using my imap account,
and the drafts folder points to Drafts folder in my imap account. 

Latest build I saw this: 9-4-01 commercial build on Win 2k.
drafts->esther
QA Contact: sheelar → esther
I saw this bug again today when I tried to send my usual krispy kreme mail today
morning. I tried to save it as draft, but I couldn't see it in my drafts folder :(

Build used: 9-10-01 BRANCH commercial build on Win2K.
wierd!
Status: NEW → ASSIGNED
Keywords: dataloss
Target Milestone: --- → mozilla0.9.9
has anyone seen this recently?
Target Milestone: mozilla0.9.9 → ---
Yes, in 2002031103. Not sure if it's fixed in the latest due to another blocker..
If you have this problem, here's one preference to check for: 
  Edit/Mail Account Settings/(account name)/Copies and Folders
For example, it might be set to save drafts to "Local Folders"/Drafts
instead of the (account name)/Drafts folder.
WORKSFORME. I was seeing similar (although not identical) problems with Moz 1.0.
Saving drafts works beautifully now with Moz 1.1 (so long as the appropriate
folder exists; but that should be a separate bug).
I consistently have this problem with 1.2. I did not have this problem with 1.1.
I am not able to reproduce this problem!
Tony provided me the following log:

----------------------------
CREATE nsMsgComposeAndSend: 46dd0d0
CREATE nsMsgComposeSendListener: 468a900
WARNING: malformed hostname, file s:/mozilla/netwerk/base/src/nsURLParsers.cpp,
line 580
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(mComposeStringBundle->GetStringFromID(aStri
ngID, aString))) failed, file s:/mozilla/mailnews/compose/src/nsMsgComposeString
Bundle.cpp, line 74
WEBSHELL+ = 8
WARNING: DropTimeout proceeding without context., file s:/mozilla/dom/src/base/n
sGlobalWindow.cpp, line 4876
WEBSHELL- = 7
WEBSHELL- = 6
nsMsgComposeSendListener: the message copy operation failed!
failed to SendMsg: [Exception... "Component returned failure code: 0x804b000a [n
sIMsgCompose.SendMsg]"  nsresult: "0x804b000a (<unknown>)"  location: "JS frame
:: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: GenericS
endMessage :: line 1827"  data: no]

The error 0x804B000A is NS_ERROR_MALFORMED_URI. Therfore the first warning we
see in the log is the problem. I have to figure out which URI we are trying to
parse...
TOny, looks like you have a space character in the hostname part of a URL
(probably the imap server). Can you verify your IMAP account settings or send me
your prefs.js file.

The url which cause problem is: mailbox://nobody@Local Folders/Drafts

I don't know yet how that could append but I'll check which my team mate to see
is someone has a clue.

Meanwhile, you can correct the problem that way:

1) Quit Netscape/Mozilla
2) Open your prefs.jf in your profile directory with a text editor
3) Replace any instance of  "mailbox://nobody@Local Folders/ and replace it by
"mailbox://nobody@Local%20Folders/
4) Save the file and start Netscape/Mozilla
Tony, is your profile migrated from NS 4.x or is the one you created in NS 7.x?
There were two such strings in my prefs.js.
    "mail.identity.id3.draft_folder"
and
    "mail.identity.id3.stationery_folder"

As for my upgrade path, I started with NS 4.x, migrated to NS 6, NS 7, then
Mozilla 1.1, and finally to 1.2 alpha followed by 1.2.
By the definitions on <http://bugzilla.mozilla.org/bug_status.html#severity> and
<http://bugzilla.mozilla.org/enter_bug.cgi?format=guided>, crashing and dataloss
bugs are of critical or possibly higher severity.  Only changing open bugs to
minimize unnecessary spam.  Keywords to trigger this would be crash, topcrash,
topcrash+, zt4newcrash, dataloss.
Severity: normal → critical
I can make this happen in 1.5RC2 consistently.

open mozilla
open mail (I use IMAP)
submit name and password to get mail
do not click on 'Drafts' folder
compose email
write something in the compose window
click 'Save'
close window
Look in Drafts -- nothing there!

I use the Drafts folder on my IMAP server.  When I click on the Drafts folder
once, and then try and save a message, it works.  But if the first thing I do is
to compose, save msg, close compose window, then that message is gone.
I found another condition for this bug to happen:  Drafts folder needs to have
no messages when I open mozilla.  It seems if the Drafts folder has at least one
message then the bug will not occur.
Verifying with Mozilla 1.7a. "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7a) Gecko/20040111"

The steps in comment 17 still work fine to reproduce this bug. I agree also that
comment 18 seems to be correct.

Query for blocking 1.7a release. If this isn't a blocker for 1.6 then it should
be at the very least written up in the release notes.
Flags: blocking1.7a?
Attached file Log of IMAP session for this bug (obsolete) —
I doubt that this is particularly useful, however here is a log of the IMAP
communications for this bug. The only thing it really shows is the absence of
any saving of the message to the IMAP server.
I might have to the following after yesterdays upgrade from 1.5 to 1.6.

When I start writing a mail, but want to continue later I just click the
close window (X in the upper right corner) and Mozilla pops up a message 
if I want to save the message as draft, I click save or press enter, as 
save is the default. But surprise surprise no message got saved to drafts. 
This worked in 1.5.

Manually saving with Ctrl-S or clicking the save button before closing the
compose window does save the window.

PS: This is with an IMAP4 server
Component: Composition → Networking: IMAP
Summary: Save as Draft doesn't save the msg. → IMAP: 'Save as Draft' doesn't save the message. (if URI contains a space)
So this bug does not correspond to the behaviour I experience since 
upgrading to 1.6 and later to 1.7a (20040130).
I've noticed the same as comment #21.
taking - I'll look into this. It sounds like there are several bugs described
here, however.
Assignee: mozilla → bienvenu
Status: ASSIGNED → NEW
without clear description of a specific problem and a plan of attack, not going
to hold for this.
Flags: blocking1.7a? → blocking1.7a-
I've investigated this now for a few hours and can tell you why it isn't
working, but not what needs to be done to fix it. 

My test case is:
0. ensure that moz mail was shutdown with 
  * current mailbox == inbox
  * draft folder empty and compacted
1. start moz mail 
2. compose email
  * from = 2 addresses
  * subject = foo
  * body = bar
  * (note: I don't think the subject/body have any affect)
3. press the 'save' button
-> observed effect is that the message is not saved to the Drafts folder

I'll attach an IMAP log for this test case next (followed by selecting the
Drafts folder, followed by pressing the 'save' button again).

What I can see happening is that there is no connection to the IMAP server to
use, so it creates a new connection. It then finds that the folder hasn't been
selected, so it selects the folder (this is nsImapProtocol.cpp, 1797-1800). It
then falls into the tests for "uidValidityOk" from lines 1808 through 1824. On
line 1821:

uidValidityOk = (uidValidity == kUidUnknown) || (uidValidity ==
GetServerStateParser().FolderUID());

uidValidityOk gets set to false. This is because the m_uidValidity value in
m_imapMailFolderSink is initialized to 0 (nsImapMailFolder.cpp:227) instead of
kUidUnknown (which I assume it should be set to). SetUidValidity() has never
been called for this folder, so it returns the default, and as 0 != kUidUnknown,
uidValidityOk turns out false.

The follows through to fail the test at line 1826 because uidValidityOk is false:

if (GetServerStateParser().LastCommandSuccessful() && !DeathSignalReceived() &&
(uidValidityOk || m_imapAction == nsIImapUrl::nsImapDeleteAllMsgs))

which means that the actual nsImapAppendDraftFromFile action is never called.

There seems to be 2 problems. 
* first that (nsImapMailFolder.cpp:227) is setting m_imapMailFolderSink to 0
instead of kUidUnknown
* second is that this is failing without an error

If the use of 0 instead of kUidUnknown is the problem, this is easily fixed. The
2nd problem of no error I'm not so sure of. I'll leave it to someone who
understands the guts of nsImapProtocol.cpp a bit better than me to determine.
This is the NSPR log file of the IMAP module while this problem is exercised.
You can see that a new connection is created in the first save to draft and
nothing more. In the second save to draft, the connection already exists and
the save goes ahead.
Attachment #138921 - Attachment is obsolete: true
No that's really not my problem "Save as Draft" problem.
(In reply to comment #28)
> No that's really not my problem "Save as Draft" problem.

Well, the original bug corresponds to exactly what was mentioned in comment #26.
 If your bug is sufficiently different, maybe it needs a new bug?
I'll try to look at this today. Thx for the research!
I reproduced this problem. Will investigate more...
Status: NEW → ASSIGNED
Attachment #141256 - Flags: superreview?(mscott)
Attachment #141256 - Flags: superreview?(mscott) → superreview+
Attachment #141256 - Flags: approval1.7a?
Comment on attachment 141256 [details] [diff] [review]
fix for imap save as draft

a=dveditz for 1.7a
Attachment #141256 - Flags: approval1.7a? → approval1.7a+
fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: