Bug 89798 - can't copy/move files to an album name that contains an apostrophe
Summary: can't copy/move files to an album name that contains an apostrophe
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Albums (show other bugs)
Version: 0.7.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-19 08:18 UTC by carlos demaine
Modified: 2023-04-08 20:57 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 8.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description carlos demaine 2004-09-19 08:18:20 UTC
Version:           0.7.0-cvs (using KDE 3.3.0,  (3.1))
Compiler:          gcc version 3.3.4 (Debian 1:3.3.4-9)
OS:                Linux (i686) release 2.6.7-1-k7

as the description states, it is impossible to copy/move exisitng files to an album name that contains an apostrophe.

eg- i try to copy/move file 1.jpg from album a to album a' and i receive the error message:

Unknown error
Could not find destination parent album for digikamio:/home/carlos/photos/The T's/P2210008.JPG

the digikamio cannot complete the operation.  this is a necessary feature as it often the case that albums need an apostrophe for plurals, shortening or possession.
Comment 1 Renchi Raju 2004-09-19 08:34:10 UTC
CVS commit by pahlibar: 


sloppy programming. forgot to escape the urls/filenames for the database
query.
CCMAIL: 89798-done@bugs.kde.org


  M +11 -11    digikamio.cpp   1.4


--- kdeextragear-3/digikam/kioslave/digikamio.cpp  #1.3:1.4
@@ -332,5 +332,5 @@ void kio_digikamioProtocol::copyInternal
         
         execSql( QString("SELECT id FROM Albums WHERE url = '%1'")
-                 .arg(oldParentURL), &vals );
+                 .arg(escapeString(oldParentURL)), &vals );
         if (vals.isEmpty())
         {
@@ -345,5 +345,5 @@ void kio_digikamioProtocol::copyInternal
         vals.clear();
         execSql( QString("SELECT id FROM Albums WHERE url = '%1'")
-                 .arg(newParentURL), &vals );
+                 .arg(escapeString(newParentURL)), &vals );
         if (vals.isEmpty())
         {
@@ -536,6 +536,6 @@ void kio_digikamioProtocol::rename(const
             // update album url
             execSql( QString("UPDATE Albums SET url = '%1' WHERE url = '%2';")
-                     .arg(newURL)
-                     .arg(oldURL) );
+                     .arg(escapeString(newURL))
+                     .arg(escapeString(oldURL)) );
 
             // Now rename all the subalbums
@@ -544,5 +544,5 @@ void kio_digikamioProtocol::rename(const
             
             execSql( QString("SELECT url FROM Albums WHERE url LIKE '%1/%'")
-                     .arg(oldURL), &suburls );
+                     .arg(escapeString(oldURL)), &suburls );
             for (QStringList::iterator it = suburls.begin(); it != suburls.end();
                  ++it)
@@ -556,9 +556,9 @@ void kio_digikamioProtocol::rename(const
                 // delete any stale albums left behind
                 execSql( QString("DELETE FROM Albums WHERE url = '%1'")
-                         .arg(url) );
+                         .arg(escapeString(url)) );
 
                 // update album url
                 execSql( QString("UPDATE Albums SET url = '%1' WHERE url = '%2';")
-                         .arg(url)
+                         .arg(escapeString(url))
                          .arg(escapeString(*it)) );
             }
@@ -613,5 +613,5 @@ void kio_digikamioProtocol::rename(const
         
         execSql( QString("SELECT id FROM Albums WHERE url = '%1'")
-                 .arg(oldParentURL), &vals );
+                 .arg(escapeString(oldParentURL)), &vals );
         if (vals.isEmpty())
         {
@@ -626,5 +626,5 @@ void kio_digikamioProtocol::rename(const
         vals.clear();
         execSql( QString("SELECT id FROM Albums WHERE url = '%1'")
-                 .arg(newParentURL), &vals );
+                 .arg(escapeString(newParentURL)), &vals );
         if (vals.isEmpty())
         {
@@ -729,5 +729,5 @@ void kio_digikamioProtocol::del(const KU
         
         execSql( QString("SELECT id FROM Albums WHERE url = '%1'")
-                 .arg(parentURL), &vals );
+                 .arg(escapeString(parentURL)), &vals );
         if (vals.isEmpty())
         {
@@ -840,5 +840,5 @@ void kio_digikamioProtocol::removeDirFro
 {
     execSql( QString("DELETE FROM Albums WHERE url = '%1'")
-             .arg(url) );
+             .arg(escapeString(url)) );
 }