Bug 104788 - Spurious "Missing Newsgorups: header" message when article subject contains a newline
Summary: Spurious "Missing Newsgorups: header" message when article subject contains a...
Status: RESOLVED FIXED
Alias: None
Product: knode
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Volker Krause
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-29 20:24 UTC by Tristan Miller
Modified: 2006-04-27 11:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot showing described behaviour (138.77 KB, image/png)
2005-04-29 20:25 UTC, Tristan Miller
Details
Screenshot showing corrupted outbox (135.38 KB, image/png)
2005-04-29 21:05 UTC, Tristan Miller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tristan Miller 2005-04-29 20:24:49 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    SuSE RPMs

Reproducibility: Always

Steps to reproduce:

1. Article->Post to Newsgroup.  Article composer pops up.
2. Type in a newsgroup of your choice if KNode didn't already specify one.  Leave the Subject field blank for now.
3. Enter some article text.
4. Using the keyboard, select and copy a line of text, including the newline, from the article body.  That is, cursor to the beginning of a line of text, press Shift-Down, then Ctrl+Ins.
5. Cursor to the Subject field.
6. Paste your selected text with Shift+Ins.
7. File->Send Now

Observed behaviour:

After step 6, it is clear that KNode has pasted the newline into the Subject field, since there's an extra unprintable character at the end of the line. After step 7, KNode pops up an error dialog indicating the send failed.  The error message listed is "441 Post rejected, formatting error: Missing Newsgroups: header"

Expected behaviour:

KNode should either silently strip any newlines from the Subject field, or warn the user when he attempts to send such a malformed Subject.  The current error message is misleading as it does not give any indication of what is really wrong or how to fix the problem.
Comment 1 Tristan Miller 2005-04-29 20:25:30 UTC
Created attachment 10845 [details]
Screenshot showing described behaviour
Comment 2 Tristan Miller 2005-04-29 21:04:20 UTC
Important note: because the Subject header's embedded newline is saved along with the message, this bug also causes corruption of the outbox folder.  That is, KNode interprets the blank line as the end of the article headers and the beginning of the body.  See attached screenshot.
Comment 3 Tristan Miller 2005-04-29 21:05:38 UTC
Created attachment 10846 [details]
Screenshot showing corrupted outbox
Comment 4 Volker Krause 2005-05-15 14:34:27 UTC
I wasn't able to reproduce the message corruption, but it's definitely a bug, I'll fix this.
Comment 5 Volker Krause 2005-05-15 14:48:28 UTC
SVN commit 414155 by vkrause:

Remove newlines from the subject.

CCBUG: 104788


 M  +10 -2     trunk/KDE/kdepim/knode/kncomposer.cpp  


--- trunk/KDE/kdepim/knode/kncomposer.cpp #414154:414155
@@ -1423,8 +1423,16 @@
 
 void KNComposer::slotSubjectChanged(const QString &t)
 {
-  if(!t.isEmpty()) setCaption(t);
-  else setCaption(i18n("No Subject"));
+  // replace newlines
+  QString subject = t;
+  subject.replace( '\n', ' ' );
+  subject.replace( '\r', ' ' );
+  v_iew->s_ubject->setText( subject );
+  // update caption
+  if( !subject.isEmpty() )
+    setCaption( subject );
+  else
+    setCaption( i18n("No Subject") );
 }
 
 
Comment 6 Volker Krause 2005-05-15 14:58:39 UTC
SVN commit 414160 by vkrause:

Backport from trunk:

Remove newlines from the subject.

BUG: 104788


 M  +10 -2     branches/KDE/3.4/kdepim/knode/kncomposer.cpp  


--- branches/KDE/3.4/kdepim/knode/kncomposer.cpp #414159:414160
@@ -1423,8 +1423,16 @@
 
 void KNComposer::slotSubjectChanged(const QString &t)
 {
-  if(!t.isEmpty()) setCaption(t);
-  else setCaption(i18n("No Subject"));
+  // replace newlines
+  QString subject = t;
+  subject.replace( '\n', ' ' );
+  subject.replace( '\r', ' ' );
+  v_iew->s_ubject->setText( subject );
+  // update caption
+  if( !subject.isEmpty() )
+    setCaption( subject );
+  else
+    setCaption( i18n("No Subject") );
 }