View Issue Details

IDProjectCategoryView StatusLast Update
0002125SOGo Connectorwith SOGopublic2013-01-18 14:32
ReporterStefan Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product VersionMonotone / nightly 
Summary0002125: Wrong filepath parsing in sync.addressbook.groupdav.js on Windows OS
Description

Path is split with "/" separator. Should be "\" for Windows OS

Additional Information

Patch uploaded

TagsNo tags attached.

Activities

2012-11-26 13:49

 

sync.addressbook.groupdav.js.diff (927 bytes)   
--- sync.addressbook.groupdav.js.old	Do Nov 15 13:03:54 2012
+++ sync.addressbook.groupdav.js	Mo Nov 26 14:34:16 2012
@@ -508,7 +508,13 @@
             if (photoURL != "") {
                 /* warning: this might not work on windows, due to the accessing of files via uris */
                 if (urlIsInSOGoImageCache(photoURL)) {
-                    let parts = photoURL.split("/");
+                    var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime);
+                    let parts;
+                    if (appInfo.OS == "WINNT"){
+                        parts = photoURL.split("\\");
+                    } else {
+                        parts = photoURL.split("/");
+                    }
                     let lastPart = parts[parts.length-1];
                     if (lastPart != "") {
                         deletePhotoFile(lastPart, true);
ludovic

ludovic

2013-01-11 17:42

reporter   ~0005142

Can you please review your patch for the current tb17 sogo connector extension?

In the meantime, I've added it for tb10.

2013-01-18 09:36

 

bug-2125.diff (1,572 bytes)   
--- sync.addressbook.groupdav.js	Do Dez  6 15:12:42 2012
+++ sync.addressbook.groupdav.js_new	Fr Jan 18 10:21:36 2013
@@ -523,18 +523,18 @@
             }
             let photoURL = oldCard.getProperty("PhotoURI", "");
             if (photoURL != "") {
-                /* warning: this might not work on windows, due to the accessing of files via uris */
                 if (urlIsInSOGoImageCache(photoURL)) {
-                    //for Windows: photoURL == file://absolute/path/to/some.jpg
-                    let parts = photoURL.split("/");
+                    //for Windows: photoURL == file://C:\Some\path\to\file
+                    var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime);
+                    let parts;
+                    if (appInfo.OS == "WINNT"){
+                        parts = photoURL.split("\\");
+                    } else {
+                        parts = photoURL.split("/");
+                    }
                     let lastPart = parts[parts.length-1];
-                    if (lastPart != "") {
-                        //on Windows, this is a absolute path. We only need the filename.
-                        parts = lastPart.split("\\");
-                        if(parts.length > 1)
-                            lastPart = parts[parts.length-1];
+                    if (lastPart != "") 
                         deletePhotoFile(lastPart, true);
-                    }
                 }
                 oldCard.deleteProperty("PhotoURI");
             }
bug-2125.diff (1,572 bytes)   
Stefan

Stefan

2013-01-18 09:37

reporter   ~0005225

Patch is ok for 17.0.2 (see patch-file for tb17)

ludovic

ludovic

2013-01-18 14:32

reporter   ~0005230

Fix also pushed for tb17. See:

https://github.com/inverse-inc/sogo-connector.tb17/commit/696c770e6716269966d54164c04706293aed967a

And for tb10:

https://github.com/inverse-inc/sogo-connector.tb10/commit/6520f09f4998d078cee0dc1229fcdbb5feae3c69

Issue History

Date Modified Username Field Change
2012-11-26 13:49 Stefan New Issue
2012-11-26 13:49 Stefan File Added: sync.addressbook.groupdav.js.diff
2013-01-11 17:42 ludovic Note Added: 0005142
2013-01-18 09:36 Stefan File Added: bug-2125.diff
2013-01-18 09:37 Stefan Note Added: 0005225
2013-01-18 14:32 ludovic Note Added: 0005230
2013-01-18 14:32 ludovic Status new => closed
2013-01-18 14:32 ludovic Resolution open => fixed