Bug 221833

Summary: [PATCH] ampersand displayed as & in ID3 comment tag
Product: [Applications] amarok Reporter: Silver Juurik <silverjuurik>
Component: Metadata Editing and ReadingAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: unnamedrambler
Priority: NOR    
Version: 2.3-GIT   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch for comment escaping

Description Silver Juurik 2010-01-08 18:51:30 UTC
Version:           git commit a5967c187497a10d99c29e1036d113a254358e7a (using KDE 4.3.4)
Compiler:          gcc-4.3.4 
OS:                Linux
Installed from:    Gentoo Packages

It seems that amarok handles ampersand in the ID3 comment tag incorrectly. "&" is always replaced with "&amp;", so editing the comment multiple times without changing the "&amp;" back to "&" manually will result in "&amp;amp;amp;" (the number of repeated "amp;"s equals the number of edits).

Steps to reproduce:
1. Open track details of any mp3 track. 
2. Enter "foo & bar" in the comment text area.
3. Click "Save & Close"
4. Open track details for the same track again. The comment is displayed as "foo &amp; bar".
5. Add a space to the comment, so it becomes "foo &amp; bar ".
6. Click "Save & Close".
7. Open track details for the track again. This time the comment is displayed as "foo &amp;amp; bar ".
Comment 1 Silver Juurik 2010-01-21 19:09:22 UTC
Created attachment 40100 [details]
patch for comment escaping

Qt::escape is applied to the comment text when opening the TagDialog. The proposed patch removes the Qt::escape. This fixes showing "&", ">" and "<" symbols.
Comment 2 Myriam Schweingruber 2010-01-21 21:12:32 UTC
Thank you for the patch, but please make a merge request on http://gitorious.org/amarok/amarok so the developers can have a look.
Comment 3 Myriam Schweingruber 2010-01-21 21:13:05 UTC
Adapting title
Comment 4 Myriam Schweingruber 2010-01-27 16:09:27 UTC
The following commit fixes this bug. Thanks again, Silver Juurik :)

commit 9e28899745919766693f85f364c7354b00135b68
Author:     Silver Juurik <silverjuurik@gmail.com>
AuthorDate: Thu Jan 21 22:43:09 2010 +0200
Commit:     Silver Juurik <silverjuurik@gmail.com>
CommitDate: Thu Jan 21 22:43:09 2010 +0200

   remove HTML escaping for the comment field in TagDialog

diff --git a/src/dialogs/TagDialog.cpp b/src/dialogs/TagDialog.cpp
index 4e04475..b01aa18 100644
--- a/src/dialogs/TagDialog.cpp
+++ b/src/dialogs/TagDialog.cpp
@@ -1013,7 +1013,7 @@ void TagDialog::readTags()
        ui->qSpinBox_year->setValue( 0 );
    ui->qSpinBox_score->setValue( m_currentData.value( Meta::Field::SCORE ).toInt() );
    ui->qSpinBox_discNumber->setValue( m_currentData.value( Meta::Field::DISCNUMBER ).toInt() );
-    ui->qPlainTextEdit_comment->setPlainText( Qt::escape( m_currentData.value( Meta::Field::COMMENT ).toString() ) );
+    ui->qPlainTextEdit_comment->setPlainText( m_currentData.value( Meta::Field::COMMENT ).toString() );

    QString summaryText, statisticsText;
    const QString body2cols = "<tr><td><nobr>%1</nobr></td><td><b>%2</b></td></tr>";