Move remote.php/webdav to remote.php/dav

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2021-07-15 12:29:28 +02:00 committed by Alper Öztürk
parent d458523e20
commit b0cc02d8cd
5 changed files with 14 additions and 30 deletions

View File

@ -14,7 +14,7 @@ import java.net.URI
*/ */
object AuthenticatorUrlUtils { 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 { fun normalizeUrlSuffix(url: String): String {
var normalizedUrl = url var normalizedUrl = url
@ -29,7 +29,7 @@ object AuthenticatorUrlUtils {
while (trimmedUrl.endsWith("/")) { while (trimmedUrl.endsWith("/")) {
trimmedUrl = trimmedUrl.substring(0, url.length - 1) 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) { if (pos >= 0) {
trimmedUrl = trimmedUrl.substring(0, pos) trimmedUrl = trimmedUrl.substring(0, pos)
} }
@ -37,8 +37,8 @@ object AuthenticatorUrlUtils {
} }
private fun trimUrlWebdav(url: String): String { private fun trimUrlWebdav(url: String): String {
return if (url.lowercase().endsWith(WEBDAV_PATH_4_0_AND_LATER)) { return if (url.lowercase().endsWith(REMOTE_PHP_PATH)) {
url.substring(0, url.length - WEBDAV_PATH_4_0_AND_LATER.length) url.substring(0, url.length - REMOTE_PHP_PATH.length)
} else { } else {
url url
} }

View File

@ -46,7 +46,7 @@ public class GetServerInfoOperation extends RemoteOperation {
* TODO ugly dependency, get rid of it. * TODO ugly dependency, get rid of it.
*/ */
public GetServerInfoOperation(String url, Context context) { public GetServerInfoOperation(String url, Context context) {
mUrl = trimWebdavSuffix(url); mUrl = AuthenticatorUrlUtils.trimWebdavSuffix(url);
mContext = context; mContext = context;
mResultData = new ServerInfo(); mResultData = new ServerInfo();
} }
@ -95,24 +95,6 @@ public class GetServerInfoOperation extends RemoteOperation {
return operation.execute(client); 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) { private String normalizeProtocolPrefix(String url, boolean isSslConn) {
if (!url.toLowerCase(Locale.ROOT).startsWith("http://") && if (!url.toLowerCase(Locale.ROOT).startsWith("http://") &&
!url.toLowerCase(Locale.ROOT).startsWith("https://")) { !url.toLowerCase(Locale.ROOT).startsWith("https://")) {

View File

@ -32,12 +32,12 @@ echo "Branch: $BRANCH"
if [ "$BRANCH" = $stableBranch ]; then if [ "$BRANCH" = $stableBranch ]; then
echo "New spotbugs result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html" 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 -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/webdav/$repository-findbugs/$stableBranch.xml" --upload-file app/build/reports/spotbugs/gplayDebug.xml 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 if [ $lintValue -ne 1 ]; then
echo "New lint result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-lint/$stableBranch.html" 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 exit 0
fi fi
else else
@ -45,10 +45,10 @@ else
6=$stableBranch"-"$(date +%F) 6=$stableBranch"-"$(date +%F)
fi fi
echo "New lint results at https://www.kaminsky.me/nc-dev/$repository-lint/${BUILD_NUMBER}.html" 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" 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 # 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("<h1>Codacy.*"))) | .id') 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("<h1>Codacy.*"))) | .id')

View File

@ -11,12 +11,14 @@
#3: DRONE_BUILD_NUMBER #3: DRONE_BUILD_NUMBER
#4: DRONE_PULL_REQUEST #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 PUBLIC_URL=https://www.kaminsky.me/nc-dev/android-artifacts
USER=$1 USER=$1
PASS=$2 PASS=$2
BUILD=$3 BUILD=$3
PR=$4 PR=$4
GITHUB_TOKEN=$5
DAV_URL=https://nextcloud.kaminsky.me/remote.php/dav/files/$USER/android-artifacts/
source scripts/lib.sh source scripts/lib.sh

View File

@ -27,7 +27,6 @@ upload() {
#5: TYPE (IT or Unit) #5: TYPE (IT or Unit)
#6: DRONE_PULL_REQUEST #6: DRONE_PULL_REQUEST
URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
ID=$3 ID=$3
USER=$1 USER=$1
PASS=$2 PASS=$2
@ -39,6 +38,7 @@ source scripts/lib.sh
REMOTE_FOLDER=$ID-$TYPE-$BRANCH-$(date +%H-%M) REMOTE_FOLDER=$ID-$TYPE-$BRANCH-$(date +%H-%M)
BRANCH_TYPE=$BRANCH-$TYPE BRANCH_TYPE=$BRANCH-$TYPE
URL=https://nextcloud.kaminsky.me/remote.php/dav/files/$USER/android-integrationTests
set -e set -e