Cancellation of current download in details view - UI changes
[pub/Android/ownCloud.git] / src / eu / alefzero / webdav / WebdavEntry.java
index e722277..84c96fb 100644 (file)
@@ -24,18 +24,19 @@ import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.webdav.property.DavPropertyName;
 import org.apache.jackrabbit.webdav.property.DavPropertySet;
 
+import android.net.Uri;
 import android.util.Log;
 
 public class WebdavEntry {
     private String mName, mPath, mUri, mContentType;
     private long mContentLength, mCreateTimestamp, mModifiedTimestamp;
 
-    public WebdavEntry(MultiStatusResponse ms) {
+    public WebdavEntry(MultiStatusResponse ms, String splitElement) {
         resetData();
         if (ms.getStatus().length != 0) {
             mUri = ms.getHref();
 
-            mPath = mUri.split("webdav.php", 2)[1];
+            mPath = mUri.split(splitElement, 2)[1];
 
             int status = ms.getStatus()[0].getStatusCode();
             DavPropertySet propSet = ms.getProperties(status);
@@ -52,6 +53,10 @@ public class WebdavEntry {
             prop = propSet.get(DavPropertyName.GETCONTENTTYPE);
             if (prop != null) {
                 mContentType = (String) prop.getValue();
+                // dvelasco: some builds of ownCloud server 4.0.x added a trailing ';' to the MIME type ; if looks fixed, but let's be cautious
+                if (mContentType.indexOf(";") >= 0) {
+                    mContentType = mContentType.substring(0, mContentType.indexOf(";"));
+                }
             } else {
                 mContentType = "DIR";
                 /*
@@ -88,6 +93,10 @@ public class WebdavEntry {
     public String path() {
         return mPath;
     }
+    
+    public String decodedPath() {
+        return Uri.decode(mPath);
+    }
 
     public String name() {
         return mName;