Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2022-05-13 16:11:02 +0300
committerHannah von Reth <vonreth@kde.org>2022-05-13 16:44:10 +0300
commit06ac999a655dadb07b721890add4ee764632d416 (patch)
tree678f8512a08f722807a7e4967b5a7ae152a74a84 /src/common
parentc118ab9e83ae48d15b061ee74d63f6066152ea3d (diff)
Ignore trailing slash in checkserverjobfactory url comparison
Diffstat (limited to 'src/common')
-rw-r--r--src/common/utility.cpp14
-rw-r--r--src/common/utility.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/src/common/utility.cpp b/src/common/utility.cpp
index c0f97ca5d..0b9bb244a 100644
--- a/src/common/utility.cpp
+++ b/src/common/utility.cpp
@@ -495,6 +495,20 @@ QUrl Utility::concatUrlPath(const QUrl &url, const QString &concatPath,
return tmpUrl;
}
+bool Utility::urlEqual(QUrl url1, QUrl url2)
+{
+ // ensure https://demo.owncloud.org/ matches https://demo.owncloud.org
+ // the empty path was the legacy formating before 2.9
+ if (url1.path().isEmpty()) {
+ url1.setPath(QStringLiteral("/"));
+ }
+ if (url2.path().isEmpty()) {
+ url2.setPath(QStringLiteral("/"));
+ }
+
+ return url1.matches(url2, QUrl::StripTrailingSlash | QUrl::NormalizePathSegments);
+}
+
QString Utility::makeConflictFileName(
const QString &fn, const QDateTime &dt, const QString &user)
{
diff --git a/src/common/utility.h b/src/common/utility.h
index 642f184c9..c309fdb4b 100644
--- a/src/common/utility.h
+++ b/src/common/utility.h
@@ -204,6 +204,9 @@ OCSYNC_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcUtility)
const QUrl &url, const QString &concatPath,
const QUrlQuery &queryItems = {});
+ /** Compares two urls and ignores whether thei end wit / */
+ OCSYNC_EXPORT bool urlEqual(QUrl a, QUrl b);
+
/** Returns a new settings pre-set in a specific group. The Settings will be created
with the given parent. If no parent is specified, the caller must destroy the settings */
OCSYNC_EXPORT std::unique_ptr<QSettings> settingsWithGroup(const QString &group, QObject *parent = nullptr);