1
0
Fork 0
mirror of https://github.com/nextcloud/android.git synced 2024-11-01 19:26:58 +01:00

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 {
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
}

View file

@ -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://")) {

View file

@ -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("<h1>Codacy.*"))) | .id')

View file

@ -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

View file

@ -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