X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/cfe4273de5fd5d54f3933a9cb8b53cdd35e1b11d..a1a31b68d989f0f9ac7d9ae101d149211008c06b:/src/eu/alefzero/webdav/WebdavEntry.java diff --git a/src/eu/alefzero/webdav/WebdavEntry.java b/src/eu/alefzero/webdav/WebdavEntry.java index 032d996a..30b5660f 100644 --- a/src/eu/alefzero/webdav/WebdavEntry.java +++ b/src/eu/alefzero/webdav/WebdavEntry.java @@ -24,6 +24,7 @@ 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 { @@ -49,16 +50,24 @@ public class WebdavEntry { mName = tmp[tmp.length - 1]; } + // use unknown mimetype as default behavior + mContentType = "application/octet-stream"; prop = propSet.get(DavPropertyName.GETCONTENTTYPE); if (prop != null) { mContentType = (String) prop.getValue(); - } else { - mContentType = "DIR"; - /* - * prop = propSet.get(DavPropertyName.ISCOLLECTION); if (prop != - * null && Boolean.parseBoolean((String) prop.getValue())) - * mContentType = "DIR"; - */ + // 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(";")); + } + } + + // check if it's a folder in the standard way: see RFC2518 12.2 , or RFC4918 14.3 + prop = propSet.get(DavPropertyName.RESOURCETYPE); + if (prop!= null) { + Object value = prop.getValue(); + if (value != null) { + mContentType = "DIR"; // a specific attribute would be better, but this is enough; unless while we have no reason to distinguish MIME types for folders + } } prop = propSet.get(DavPropertyName.GETCONTENTLENGTH); @@ -88,6 +97,10 @@ public class WebdavEntry { public String path() { return mPath; } + + public String decodedPath() { + return Uri.decode(mPath); + } public String name() { return mName; @@ -113,7 +126,7 @@ public class WebdavEntry { return mCreateTimestamp; } - public long modifiedTimesamp() { + public long modifiedTimestamp() { return mModifiedTimestamp; }