From b0cc02d8cdf91695eff4d4cc2223fe8c976ee84d Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 15 Jul 2021 12:29:28 +0200 Subject: [PATCH] Move remote.php/webdav to remote.php/dav Signed-off-by: tobiasKaminsky --- .../authentication/AuthenticatorUrlUtils.kt | 8 ++++---- .../operations/GetServerInfoOperation.java | 20 +------------------ scripts/analysis/analysis-wrapper.sh | 10 +++++----- scripts/uploadArtifact.sh | 4 +++- scripts/uploadReport.sh | 2 +- 5 files changed, 14 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/authentication/AuthenticatorUrlUtils.kt b/app/src/main/java/com/owncloud/android/authentication/AuthenticatorUrlUtils.kt index 290fac2dda..0d5921e07b 100644 --- a/app/src/main/java/com/owncloud/android/authentication/AuthenticatorUrlUtils.kt +++ b/app/src/main/java/com/owncloud/android/authentication/AuthenticatorUrlUtils.kt @@ -14,7 +14,7 @@ import java.net.URI */ object AuthenticatorUrlUtils { - const val WEBDAV_PATH_4_0_AND_LATER = "/remote.php/webdav" + private const val REMOTE_PHP_PATH = "/remote.php/dav" fun normalizeUrlSuffix(url: String): String { var normalizedUrl = url @@ -29,7 +29,7 @@ object AuthenticatorUrlUtils { while (trimmedUrl.endsWith("/")) { trimmedUrl = trimmedUrl.substring(0, url.length - 1) } - val pos = trimmedUrl.lastIndexOf(WEBDAV_PATH_4_0_AND_LATER) + val pos = trimmedUrl.lastIndexOf(REMOTE_PHP_PATH) if (pos >= 0) { trimmedUrl = trimmedUrl.substring(0, pos) } @@ -37,8 +37,8 @@ object AuthenticatorUrlUtils { } private fun trimUrlWebdav(url: String): String { - return if (url.lowercase().endsWith(WEBDAV_PATH_4_0_AND_LATER)) { - url.substring(0, url.length - WEBDAV_PATH_4_0_AND_LATER.length) + return if (url.lowercase().endsWith(REMOTE_PHP_PATH)) { + url.substring(0, url.length - REMOTE_PHP_PATH.length) } else { url } diff --git a/app/src/main/java/com/owncloud/android/operations/GetServerInfoOperation.java b/app/src/main/java/com/owncloud/android/operations/GetServerInfoOperation.java index 5124154528..fab51d9663 100644 --- a/app/src/main/java/com/owncloud/android/operations/GetServerInfoOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/GetServerInfoOperation.java @@ -46,7 +46,7 @@ public class GetServerInfoOperation extends RemoteOperation { * TODO ugly dependency, get rid of it. */ public GetServerInfoOperation(String url, Context context) { - mUrl = trimWebdavSuffix(url); + mUrl = AuthenticatorUrlUtils.trimWebdavSuffix(url); mContext = context; mResultData = new ServerInfo(); } @@ -95,24 +95,6 @@ public class GetServerInfoOperation extends RemoteOperation { return operation.execute(client); } - - private String trimWebdavSuffix(String url) { - String trimmedUrl = url; - if (trimmedUrl == null) { - trimmedUrl = ""; - } else { - if (trimmedUrl.endsWith("/")) { - trimmedUrl = trimmedUrl.substring(0, trimmedUrl.length() - 1); - } - if (trimmedUrl.toLowerCase(Locale.ROOT).endsWith(AuthenticatorUrlUtils.WEBDAV_PATH_4_0_AND_LATER)) { - trimmedUrl = trimmedUrl.substring(0, - trimmedUrl.length() - AuthenticatorUrlUtils.WEBDAV_PATH_4_0_AND_LATER.length()); - } - } - return trimmedUrl; - } - - private String normalizeProtocolPrefix(String url, boolean isSslConn) { if (!url.toLowerCase(Locale.ROOT).startsWith("http://") && !url.toLowerCase(Locale.ROOT).startsWith("https://")) { diff --git a/scripts/analysis/analysis-wrapper.sh b/scripts/analysis/analysis-wrapper.sh index e3fa3b4f92..6af7ca0d0a 100755 --- a/scripts/analysis/analysis-wrapper.sh +++ b/scripts/analysis/analysis-wrapper.sh @@ -32,12 +32,12 @@ echo "Branch: $BRANCH" if [ "$BRANCH" = $stableBranch ]; then echo "New spotbugs result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html" - curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.html --upload-file app/build/reports/spotbugs/spotbugs.html - curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.xml" --upload-file app/build/reports/spotbugs/gplayDebug.xml + curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/dav/files/${LOG_USERNAME}/$repository-findbugs/$stableBranch.html --upload-file app/build/reports/spotbugs/spotbugs.html + curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/dav/files/${LOG_USERNAME}/$repository-findbugs/$stableBranch.xml" --upload-file app/build/reports/spotbugs/gplayDebug.xml if [ $lintValue -ne 1 ]; then echo "New lint result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-lint/$stableBranch.html" - curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/$stableBranch.html --upload-file app/build/reports/lint/lint.html + curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/dav/files/${LOG_USERNAME}/$repository-lint/$stableBranch.html --upload-file app/build/reports/lint/lint.html exit 0 fi else @@ -45,10 +45,10 @@ else 6=$stableBranch"-"$(date +%F) fi echo "New lint results at https://www.kaminsky.me/nc-dev/$repository-lint/${BUILD_NUMBER}.html" - curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/${BUILD_NUMBER}.html" --upload-file app/build/reports/lint/lint.html + curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/dav/files/${LOG_USERNAME}/$repository-lint/${BUILD_NUMBER}.html" --upload-file app/build/reports/lint/lint.html echo "New spotbugs results at https://www.kaminsky.me/nc-dev/$repository-findbugs/${BUILD_NUMBER}.html" - curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/${BUILD_NUMBER}.html" --upload-file app/build/reports/spotbugs/spotbugs.html + curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/dav/files/${LOG_USERNAME}/$repository-findbugs/${BUILD_NUMBER}.html" --upload-file app/build/reports/spotbugs/spotbugs.html # delete all old comments, starting with Codacy oldComments=$(curl_gh -X GET "https://api.github.com/repos/nextcloud/$repository/issues/${PR_NUMBER}/comments" | jq '.[] | select((.user.login | contains("github-actions")) and (.body | test("

Codacy.*"))) | .id') diff --git a/scripts/uploadArtifact.sh b/scripts/uploadArtifact.sh index 333af65ceb..d3ec43b12b 100755 --- a/scripts/uploadArtifact.sh +++ b/scripts/uploadArtifact.sh @@ -11,12 +11,14 @@ #3: DRONE_BUILD_NUMBER #4: DRONE_PULL_REQUEST -DAV_URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-artifacts/ + PUBLIC_URL=https://www.kaminsky.me/nc-dev/android-artifacts USER=$1 PASS=$2 BUILD=$3 PR=$4 +GITHUB_TOKEN=$5 +DAV_URL=https://nextcloud.kaminsky.me/remote.php/dav/files/$USER/android-artifacts/ source scripts/lib.sh diff --git a/scripts/uploadReport.sh b/scripts/uploadReport.sh index e86be3bd8c..3b755333bf 100755 --- a/scripts/uploadReport.sh +++ b/scripts/uploadReport.sh @@ -27,7 +27,6 @@ upload() { #5: TYPE (IT or Unit) #6: DRONE_PULL_REQUEST -URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests ID=$3 USER=$1 PASS=$2 @@ -39,6 +38,7 @@ source scripts/lib.sh REMOTE_FOLDER=$ID-$TYPE-$BRANCH-$(date +%H-%M) BRANCH_TYPE=$BRANCH-$TYPE +URL=https://nextcloud.kaminsky.me/remote.php/dav/files/$USER/android-integrationTests set -e