From 8db0b820ff6bd4dd608140c815fbc81560be35f7 Mon Sep 17 00:00:00 2001 From: davigonz Date: Mon, 26 Aug 2019 15:25:16 +0200 Subject: [PATCH 1/6] Delete .travis.yml --- .travis.yml | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6a8a27d3..00000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -sudo: false -language: android -jdk: - - oraclejdk8 -branches: - only: - - master -install: -# Let's use the new command 'sdkmanager' to install Android SDK components -- yes | sdkmanager --verbose "build-tools;26.0.3" -- yes | sdkmanager --verbose "platform-tools" -- yes | sdkmanager --verbose "tools" -- yes | sdkmanager --verbose "platforms;android-26" -- yes | sdkmanager --verbose "system-images;android-24;default;armeabi-v7a" - -# Check tools and dependencies installed -- yes | sdkmanager --list - -# After Travis updated image with Android base environment, building via ant is not possible anymore. -# Port library tests to new-style with JUnit 4 and gradle build. -- rm pom.xml - -# On the other hand, Travis still uses 'android' command behind the 'components' section update. -# That command is obsolete and cannot update Android SDK Tools after 25.2.5. -# Let's solve it here with the new command 'sdkmanager' -- yes | sdkmanager --verbose tools -script: -- ./gradlew clean build -env: - global: - # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created - # via the "travis encrypt" command using the project repo's public key - - secure: epTZ0zZGDbHL3o6vSC9uNkZsi5j5SA6O/tvQBH7QW/dluuzIJxIjfhNbZHDyBReYDleirLzUFQpdWAUdvulCMLs/qZdIzFGlYXZSpxEnvPYMGQcilwADdJcxLw8L+3+ET5hSexxhjrTGw427IljkqGUpqQTxaLwFdFu98lDWSbc= - matrix: - - ANDROID_TARGET=android-26 ANDROID_ABI=armeabi-v7a -addons: - coverity_scan: - project: - name: owncloud/android-library - description: Build submitted via Travis CI - notification_email: lukas@owncloud.com - build_command_prepend: gradle clean - build_command: gradle build - branch_pattern: coverity_scan From 90cef9fcf665980c9c372201e2702dfaa6045aa9 Mon Sep 17 00:00:00 2001 From: davigonz Date: Fri, 23 Aug 2019 14:10:38 +0200 Subject: [PATCH 2/6] Use remoteId of the just copied file --- .../android/lib/common/http/HttpConstants.java | 1 + .../resources/files/CopyRemoteFileOperation.java | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/HttpConstants.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/HttpConstants.java index 201d3b3a..2cd4df0d 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/HttpConstants.java +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/HttpConstants.java @@ -50,6 +50,7 @@ public class HttpConstants { public static final String CONTENT_TYPE_URLENCODED_UTF8 = "application/x-www-form-urlencoded; charset=utf-8"; public static final String ACCEPT_ENCODING_HEADER = "Accept-Encoding"; public static final String ACCEPT_ENCODING_IDENTITY = "identity"; + public static final String OC_FILE_REMOTE_ID = "OC-FileId"; /*********************************************************************************************************** ************************************************ STATUS CODES ********************************************* diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/CopyRemoteFileOperation.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/CopyRemoteFileOperation.java index 9282bd42..79852444 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/CopyRemoteFileOperation.java +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/CopyRemoteFileOperation.java @@ -47,7 +47,7 @@ import java.util.concurrent.TimeUnit; * @author David A. Velasco * @author Christian Schabesberger */ -public class CopyRemoteFileOperation extends RemoteOperation { +public class CopyRemoteFileOperation extends RemoteOperation { private static final String TAG = CopyRemoteFileOperation.class.getSimpleName(); @@ -80,8 +80,7 @@ public class CopyRemoteFileOperation extends RemoteOperation { * @param client Client object to communicate with the remote ownCloud server. */ @Override - protected RemoteOperationResult run(OwnCloudClient client) { - + protected RemoteOperationResult run(OwnCloudClient client) { OwnCloudVersion version = client.getOwnCloudVersion(); boolean versionWithForbiddenChars = (version != null && version.isVersionWithForbiddenCharacters()); @@ -101,9 +100,10 @@ public class CopyRemoteFileOperation extends RemoteOperation { } /// perform remote operation - RemoteOperationResult result = null; + RemoteOperationResult result; try { - CopyMethod copyMethod = new CopyMethod(new URL(client.getUserFilesWebDavUri() + WebdavUtils.encodePath(mSrcRemotePath)), + CopyMethod copyMethod = + new CopyMethod(new URL(client.getUserFilesWebDavUri() + WebdavUtils.encodePath(mSrcRemotePath)), client.getUserFilesWebDavUri() + WebdavUtils.encodePath(mTargetRemotePath), mOverwrite); @@ -113,16 +113,17 @@ public class CopyRemoteFileOperation extends RemoteOperation { final int status = client.executeHttpMethod(copyMethod); if (status == HttpConstants.HTTP_CREATED || status == HttpConstants.HTTP_NO_CONTENT) { + String fileRemoteId = copyMethod.getResponseHeader(HttpConstants.OC_FILE_REMOTE_ID); result = new RemoteOperationResult<>(ResultCode.OK); + result.setData(fileRemoteId); } else if (status == HttpConstants.HTTP_PRECONDITION_FAILED && !mOverwrite) { - result = new RemoteOperationResult<>(ResultCode.INVALID_OVERWRITE); client.exhaustResponse(copyMethod.getResponseBodyAsStream()); /// for other errors that could be explicitly handled, check first: /// http://www.webdav.org/specs/rfc4918.html#rfc.section.9.9.4 - } else { + result = new RemoteOperationResult<>(copyMethod); client.exhaustResponse(copyMethod.getResponseBodyAsStream()); } From 36df3d9287c69e7b09a66c449811d68f2af0296a Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Sun, 8 Sep 2019 09:25:39 +0200 Subject: [PATCH 3/6] Android Studio 3.5.0 --- .classpath | 9 ------- .idea/codeStyles/Project.xml | 34 ------------------------ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 +-- owncloudComLibrary/build.gradle | 4 +-- 5 files changed, 5 insertions(+), 48 deletions(-) delete mode 100644 .classpath diff --git a/.classpath b/.classpath deleted file mode 100644 index 51769745..00000000 --- a/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 6d603841..0a8ab42d 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -2,17 +2,11 @@