Handling of PUT response code fixed
[pub/Android/ownCloud.git] / src / eu / alefzero / webdav / WebdavClient.java
index a539800..150f9b8 100644 (file)
@@ -186,7 +186,7 @@ public class WebdavClient extends HttpClient {
      */\r
     public boolean putFile(String localFile, String remoteTarget,\r
             String contentType) {\r
-        boolean result = true;\r
+        boolean result = false;\r
 \r
         try {\r
             Log.e("ASD", contentType + "");\r
@@ -200,7 +200,11 @@ public class WebdavClient extends HttpClient {
             int status = executeMethod(put, 0);\r
             Log.d(TAG, "PUT method return with status " + status);\r
 \r
-            Log.i(TAG, "Uploading, done");\r
+            if (status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED || status == HttpStatus.SC_NO_CONTENT) {\r
+                result = true;\r
+                Log.i(TAG, "Uploading, done");\r
+            }\r
+            \r
         } catch (final Exception e) {\r
             Log.i(TAG, "" + e.getMessage());\r
             result = false;\r