Loading src/com/owncloud/android/lib/common/network/WebdavEntry.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -129,7 +129,7 @@ public class WebdavEntry { prop = propSet.get(DavPropertyName.GETETAG); prop = propSet.get(DavPropertyName.GETETAG); if (prop != null) { if (prop != null) { mEtag = (String) prop.getValue(); mEtag = (String) prop.getValue(); mEtag = mEtag.substring(1, mEtag.length()-1); mEtag = WebdavUtils.parseEtag(mEtag); } } // {DAV:}quota-used-bytes // {DAV:}quota-used-bytes Loading src/com/owncloud/android/lib/common/network/WebdavUtils.java +45 −0 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,8 @@ import java.util.Locale; import android.net.Uri; import android.net.Uri; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpMethod; import org.apache.jackrabbit.webdav.property.DavPropertyName; import org.apache.jackrabbit.webdav.property.DavPropertyName; import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.xml.Namespace; import org.apache.jackrabbit.webdav.xml.Namespace; Loading Loading @@ -131,4 +133,47 @@ public class WebdavUtils { return propSet; return propSet; } } /** * * @param rawEtag * @return */ public static String parseEtag(String rawEtag) { if (rawEtag == null || rawEtag.length() == 0) { return ""; } if (rawEtag.endsWith("-gzip")) { rawEtag = rawEtag.substring(0, rawEtag.length() - 5); } if (rawEtag.length() >= 2 && rawEtag.startsWith("\"") && rawEtag.endsWith("\"")) { rawEtag = rawEtag.substring(1, rawEtag.length() - 1); } return rawEtag; } /** * * @param method * @return */ public static String getEtagFromResponse(HttpMethod method) { Header eTag = method.getResponseHeader("OC-ETag"); if (eTag == null) { eTag = method.getResponseHeader("oc-etag"); } if (eTag == null) { eTag = method.getResponseHeader("ETag"); } if (eTag == null) { eTag = method.getResponseHeader("etag"); } String result = ""; if (eTag != null) { result = parseEtag(eTag.getValue()); } return result; } } } src/com/owncloud/android/lib/resources/files/DownloadRemoteFileOperation.java +3 −10 Original line number Original line Diff line number Diff line Loading @@ -150,16 +150,9 @@ public class DownloadRemoteFileOperation extends RemoteOperation { } else { } else { Log_OC.e(TAG, "Could not read modification time from response downloading " + mRemotePath); Log_OC.e(TAG, "Could not read modification time from response downloading " + mRemotePath); } } Header eTag = mGet.getResponseHeader("ETag"); if (eTag == null) { mEtag = WebdavUtils.getEtagFromResponse(mGet); eTag = mGet.getResponseHeader("etag"); if (mEtag.length() == 0) { } if (eTag != null) { mEtag = eTag.getValue(); if (mEtag.charAt(0) == '"' && mEtag.charAt(mEtag.length() - 1) == '"') { mEtag = mEtag.substring(1, mEtag.length() - 1); } } else { Log_OC.e(TAG, "Could not read eTag from response downloading " + mRemotePath); Log_OC.e(TAG, "Could not read eTag from response downloading " + mRemotePath); } } Loading Loading
src/com/owncloud/android/lib/common/network/WebdavEntry.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -129,7 +129,7 @@ public class WebdavEntry { prop = propSet.get(DavPropertyName.GETETAG); prop = propSet.get(DavPropertyName.GETETAG); if (prop != null) { if (prop != null) { mEtag = (String) prop.getValue(); mEtag = (String) prop.getValue(); mEtag = mEtag.substring(1, mEtag.length()-1); mEtag = WebdavUtils.parseEtag(mEtag); } } // {DAV:}quota-used-bytes // {DAV:}quota-used-bytes Loading
src/com/owncloud/android/lib/common/network/WebdavUtils.java +45 −0 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,8 @@ import java.util.Locale; import android.net.Uri; import android.net.Uri; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpMethod; import org.apache.jackrabbit.webdav.property.DavPropertyName; import org.apache.jackrabbit.webdav.property.DavPropertyName; import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.xml.Namespace; import org.apache.jackrabbit.webdav.xml.Namespace; Loading Loading @@ -131,4 +133,47 @@ public class WebdavUtils { return propSet; return propSet; } } /** * * @param rawEtag * @return */ public static String parseEtag(String rawEtag) { if (rawEtag == null || rawEtag.length() == 0) { return ""; } if (rawEtag.endsWith("-gzip")) { rawEtag = rawEtag.substring(0, rawEtag.length() - 5); } if (rawEtag.length() >= 2 && rawEtag.startsWith("\"") && rawEtag.endsWith("\"")) { rawEtag = rawEtag.substring(1, rawEtag.length() - 1); } return rawEtag; } /** * * @param method * @return */ public static String getEtagFromResponse(HttpMethod method) { Header eTag = method.getResponseHeader("OC-ETag"); if (eTag == null) { eTag = method.getResponseHeader("oc-etag"); } if (eTag == null) { eTag = method.getResponseHeader("ETag"); } if (eTag == null) { eTag = method.getResponseHeader("etag"); } String result = ""; if (eTag != null) { result = parseEtag(eTag.getValue()); } return result; } } }
src/com/owncloud/android/lib/resources/files/DownloadRemoteFileOperation.java +3 −10 Original line number Original line Diff line number Diff line Loading @@ -150,16 +150,9 @@ public class DownloadRemoteFileOperation extends RemoteOperation { } else { } else { Log_OC.e(TAG, "Could not read modification time from response downloading " + mRemotePath); Log_OC.e(TAG, "Could not read modification time from response downloading " + mRemotePath); } } Header eTag = mGet.getResponseHeader("ETag"); if (eTag == null) { mEtag = WebdavUtils.getEtagFromResponse(mGet); eTag = mGet.getResponseHeader("etag"); if (mEtag.length() == 0) { } if (eTag != null) { mEtag = eTag.getValue(); if (mEtag.charAt(0) == '"' && mEtag.charAt(mEtag.length() - 1) == '"') { mEtag = mEtag.substring(1, mEtag.length() - 1); } } else { Log_OC.e(TAG, "Could not read eTag from response downloading " + mRemotePath); Log_OC.e(TAG, "Could not read eTag from response downloading " + mRemotePath); } } Loading