Parse the folder name correctly in case it ends with /
authorChristos Stathis <chstath@ebs.gr>
Fri, 18 Nov 2011 15:30:32 +0000 (17:30 +0200)
committerChristos Stathis <chstath@ebs.gr>
Fri, 18 Nov 2011 15:30:32 +0000 (17:30 +0200)
src/gr/grnet/pithos/web/client/foldertree/Folder.java

index 386109f..4f8d985 100644 (file)
@@ -201,6 +201,7 @@ public class Folder extends Resource {
             path = unmarshallString(o, "name");
             lastModified = unmarshallDate(o, "last_modified");
         }
+        //Strip the last / if exists in order to determine the name, but remember to put it back
         boolean endsWithSlash = false;
         if (path.endsWith("/")) {
             path = path.substring(0, path.length() - 1);
@@ -210,8 +211,10 @@ public class Folder extends Resource {
             name = path.substring(path.lastIndexOf("/") + 1, path.length()); //strip the prefix
         else
             name = path;
-        if (endsWithSlash)
+        if (endsWithSlash) {
+               path += "/";
                name += "/";
+        }
         if (aContainer != null) {
             container = aContainer;
             prefix = path;