Account: Make sure that davPath() always comes with trailing slash.
authorKlaas Freitag <freitag@owncloud.com>
Thu, 10 Sep 2015 13:38:40 +0000 (15:38 +0200)
committerKlaas Freitag <freitag@owncloud.com>
Thu, 10 Sep 2015 13:38:40 +0000 (15:38 +0200)
src/libsync/account.cpp
src/libsync/account.h

index 03089800bc49b848653a09208ea5df306c92f2c0..86c808c742548adde8fcf0995aafd88007a4fd5d 100644 (file)
@@ -61,6 +61,17 @@ Account::~Account()
     delete _am;
 }
 
+QString Account::davPath() const
+{
+    // make sure to have a trailing slash
+    if( !_davPath.endsWith('/') ) {
+        QString dp(_davPath);
+        dp.append('/');
+        return dp;
+    }
+    return _davPath;
+}
+
 void Account::setSharedThis(AccountPtr sharedThis)
 {
     _sharedThis = sharedThis.toWeakRef();
index 986bf85f5a9f3eaa7ded82e7766709d1147fa193..a1b734c0300cae3a0c9478d31f4f94131be44497 100644 (file)
@@ -60,7 +60,12 @@ public:
 class OWNCLOUDSYNC_EXPORT Account : public QObject {
     Q_OBJECT
 public:
-    QString davPath() const { return _davPath; }
+    /**
+     * @brief The possibly themed dav path for the account. Is has
+     *        a trailing slash.
+     * @returns the (themeable) dav path for the account.
+     */
+    QString davPath() const;
     void setDavPath(const QString&s) { _davPath = s; }
 
     static AccountPtr create();