Bug 131343 - Sending images from digikam fails if directory name contains parentheses
Summary: Sending images from digikam fails if directory name contains parentheses
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Generic-SendByMail (show other bugs)
Version: 5.6.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-25 12:11 UTC by Brian
Modified: 2022-01-15 18:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 7.6.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian 2006-07-25 12:11:29 UTC
Version:           0.1.0_0.1 (using KDE KDE 3.5.3)
Installed from:    SuSE RPMs
OS:                Linux

When sending an image from a directory named 'Leith Hill (Spring)', using Thunderbird as the mail client, Thunderbird was started but the 'compose' window failed to appear.

The console log showed the error:
   "TypeError: a has no properties"

This fault was solid.

After renaming the directory to 'Leith Hill - Spring', it worked correctly.
Comment 1 Tom Albers 2006-07-25 12:35:12 UTC
Ok, i'll look at it.
Comment 2 Tom Albers 2006-07-25 20:28:31 UTC
SVN commit 566299 by toma:

Thunderbird's commandline does not like ( and ). Filter them out in the temp file name.
BUG:131343



 M  +5 -1      sendimages.cpp  


--- trunk/extragear/libs/kipi-plugins/sendimages/sendimages.cpp #566298:566299
@@ -150,8 +150,12 @@
            // Prepare resizing images.
 
            QString imageFileName = ItemName;
+           QString f = (*it).directory().section('/', -1);
 
-           QString imageNameFormat = (*it).directory().section('/', -1) + "-" +
+           // Thunderbird does not like (). Replace them, BUG:131343
+           f.replace(QChar('('), "_").replace(QChar(')'), "_");
+
+           QString imageNameFormat = f + "-" +
                                      imageFileName.replace(QChar('.'), "_") +
                                      extension(m_imageFormat);
 
Comment 3 Achim Bohnet 2006-08-02 19:20:24 UTC
On Tuesday 25 July 2006 20:28, Tom Albers wrote:
[...] 
> Thunderbird's commandline does not like ( and ). Filter them out in the temp file name.
> BUG:131343


Well, not quite right.   For a filename 'one ( test ) case',  this works perfectly

  mozilla-thunderbird -remote xfeDoCommand\(composeMessage,attachment=file://$PWD/one%20%28%20test%20%29%20case\)

As attachment= is a URL, it should be url encoded.

Achim

[...]
Comment 4 Angelo Naselli 2006-08-02 21:57:55 UTC
I do believe we should find a common way to solve
this problem in libkipi to avoid code duplication.

Angelo
Comment 5 Tom Albers 2006-08-03 16:22:17 UTC
so you want to use 'one%20%28%20test%20%29%20case' as a filename everywhere?
Comment 6 Tom Albers 2006-08-03 16:23:45 UTC
must get some new glasses  -> reopen
Comment 7 Angelo Naselli 2006-08-03 16:35:41 UTC
Toma have a look at Aurelien's webifyFileName function in generator.cpp (html export)
I added it in cd archive. I'd like to have it once, and for all, though :)
Comment 8 Achim Bohnet 2006-08-03 19:59:09 UTC
On Thursday 03 August 2006 16:22, Tom Albers wrote:
[...]
> ------- Additional Comments From tomalbers kde nl  2006-08-03 16:22 -------
> so you want to use 'one%20%28%20test%20%29%20case' as a filename everywhere?


No. The filename on disk is  readable: 'one ( test ) case'.
The urlencoded string 'one%20%28%20test%20%29%20case' in only used for
URL passed to firefox.  Firefox decodes it and opens the 'readable'
version on disk.

Achim
P.S. OT: for digikam one can argue if encoding '/' as %2f so it's
hidden to the user that an album is a directory.
[...]
Comment 9 Tom Albers 2006-08-09 23:25:03 UTC
For now, there is no alternative call to any library which encodes the ( and ), so I'll stick with the conversion to _ for now. When there is a central spot for encoding, the code has to change anyhow.
Comment 10 Achim Bohnet 2006-08-10 02:11:39 UTC
Just for the record, what was discussed on IRC

URL encoding is described in
http://www.ietf.org/rfc/rfc1738.txt  Search for 'Unsafe:'
to find that chars that have to be escaped.  '(' and ')'
are not in this list.

KURL::setPath() 'only' encodes "/@<>#\"&%?={}|^~[]\'`\\:+

Unless the xfeDoCommand uses '(' and ')' for it own
purposes, thunderbird should accept them unescaped (->bug)

Achim
Comment 11 Tom Albers 2006-08-10 10:10:12 UTC
It probably has to do with their syntax that () are not parsed correctly:
mozilla-thunderbird -remote xfeDoCommand(composeMessage,attachment=$filename) 

In any case, invokeMailer should be used from kde4 on, so kdelibs should tackle this.