Sfoglia il codice sorgente

Use dav instead of webdav

Fixes #3342

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Felix Weilbach 4 anni fa
parent
commit
3e61bdc431

+ 1 - 1
doc/architecture.rst

@@ -152,7 +152,7 @@ Conflict files are always created on the client and never on the server.
             "capabilities":{
                 "core":{
                   "pollinterval":60,
-                  "webdav-root":"remote.php/webdav"
+                  "webdav-root":"remote.php/dav"
                 },
                 "dav":{
                   "chunking":"1.0"

+ 3 - 3
doc/nextcloudcmd.rst

@@ -92,7 +92,7 @@ Credential Handling
 
 ::
 
-  $ nextcloudcmd /home/user/my_sync_folder https://carla:secret@server/nextcloud/remote.php/webdav/
+  $ nextcloudcmd /home/user/my_sync_folder https://carla:secret@server/nextcloud/remote.php/dav/
 
 To synchronize the Nextcloud directory ``Music`` to the local directory
 ``media/music``, through a proxy listening on port ``8080``, and on a gateway
@@ -100,7 +100,7 @@ machine using IP address ``192.168.178.1``, the command line would be::
 
   $ nextcloudcmd --httpproxy http://192.168.178.1:8080 \
                 $HOME/media/music \
-                https://server/nextcloud/remote.php/webdav/Music
+                https://server/nextcloud/remote.php/dav/Music
 
 ``nextcloudcmd`` will prompt for the user name and password, unless they have
 been specified on the command line or ``-n`` has been passed.
@@ -121,4 +121,4 @@ Example
 ::
 
     $ nextcloudcmd /home/user/<my_sync_folder> \
-    https://<username>:<secret>@<server_address>/remote.php/webdav/<Directory_that_has_been_created>
+    https://<username>:<secret>@<server_address>/remote.php/dav/<Directory_that_has_been_created>

+ 1 - 1
doc/troubleshooting.rst

@@ -34,7 +34,7 @@ Identifying Basic Functionality Problems
 
   For example, if your Nextcloud instance is installed at
   ``http://yourserver.com/nextcloud``, your WebDAV server address is
-  ``http://yourserver.com/nextcloud/remote.php/webdav``.
+  ``http://yourserver.com/nextcloud/remote.php/dav``.
 
   If you are prompted for your username and password but, after providing the
   correct credentials, authentication fails, please ensure that your

+ 2 - 2
man/nextcloudcmd.1.rst

@@ -76,7 +76,7 @@ the command line would be::
 
   $ nextcloudcmd —httpproxy http://192.168.178.1:8080 \
                 $HOME/media/music \
-                https://server/nextcloud/remote.php/webdav/Music
+                https://server/nextcloud/remote.php/dav/Music
 
 ``nextcloudcmd`` will enquire user name and password, unless they have
 been specified on the command line or ``-n`` (see `netrc(5)`) has been passed.
@@ -85,7 +85,7 @@ Using the legacy scheme, it would be::
 
   $ nextcloudcmd —httpproxy http://192.168.178.1:8080 \
                 $HOME/media/music \
-                nextclouds://server/nextcloud/remote.php/webdav/Music
+                nextclouds://server/nextcloud/remote.php/dav/Music
 
 
 BUGS

+ 1 - 1
src/gui/owncloudsetupwizard.cpp

@@ -465,7 +465,7 @@ void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString &localFo
          *
          *         Purpose: Don't rely on unsafe paths, be extra careful.
          *
-         *         Example: https://cloud.example.com/remote.php/webdav//
+         *         Example: https://cloud.example.com/remote.php/dav//
          *
         */
         qCInfo(lcWizard) << "Sanitize got URL path:" << QString(_ocWizard->account()->url().toString() + '/' + _ocWizard->account()->davPath() + remoteFolder);

+ 1 - 1
src/libsync/networkjobs.cpp

@@ -403,7 +403,7 @@ bool LsColJob::finished()
         connect(&parser, &LsColXMLParser::finishedWithoutError,
             this, &LsColJob::finishedWithoutError);
 
-        QString expectedPath = reply()->request().url().path(); // something like "/owncloud/remote.php/webdav/folder"
+        QString expectedPath = reply()->request().url().path(); // something like "/owncloud/remote.php/dav/folder"
         if (!parser.parse(reply()->readAll(), &_folderInfos, expectedPath)) {
             // XML parse error
             emit finishedWithError(reply());

+ 1 - 1
src/libsync/theme.cpp

@@ -645,7 +645,7 @@ bool Theme::wizardSelectiveSyncDefaultNothing() const
 
 QString Theme::webDavPath() const
 {
-    return QLatin1String("remote.php/webdav/");
+    return QLatin1String("remote.php/dav/");
 }
 
 QString Theme::webDavPathNonShib() const

+ 1 - 1
src/libsync/theme.h

@@ -341,7 +341,7 @@ public:
      * Alternative path on the server that provides access to the webdav capabilities
      *
      * Attention: Make sure that this string does NOT have a leading slash and that
-     * it has a trailing slash, for example "remote.php/webdav/".
+     * it has a trailing slash, for example "remote.php/dav/".
      */
     virtual QString webDavPath() const;
     virtual QString webDavPathNonShib() const;

+ 5 - 4
test/syncenginetestutils.h

@@ -34,18 +34,19 @@
  */
 
 
-static const QUrl sRootUrl("owncloud://somehost/owncloud/remote.php/webdav/");
+static const QUrl sRootUrl("owncloud://somehost/owncloud/remote.php/dav/");
 static const QUrl sRootUrl2("owncloud://somehost/owncloud/remote.php/dav/files/admin/");
 static const QUrl sUploadUrl("owncloud://somehost/owncloud/remote.php/dav/uploads/admin/");
 
-inline QString getFilePathFromUrl(const QUrl &url) {
+inline QString getFilePathFromUrl(const QUrl &url)
+{
     QString path = url.path();
-    if (path.startsWith(sRootUrl.path()))
-        return path.mid(sRootUrl.path().length());
     if (path.startsWith(sRootUrl2.path()))
         return path.mid(sRootUrl2.path().length());
     if (path.startsWith(sUploadUrl.path()))
         return path.mid(sUploadUrl.path().length());
+    if (path.startsWith(sRootUrl.path()))
+        return path.mid(sRootUrl.path().length());
     return {};
 }
 

+ 1 - 1
test/testallfilesdeleted.cpp

@@ -214,7 +214,7 @@ private slots:
             if (verb == "PROPFIND") {
                 auto data = stream->readAll();
                 if (data.contains("data-fingerprint")) {
-                    if (request.url().path().endsWith("webdav/"))
+                    if (request.url().path().endsWith("dav/"))
                         ++fingerprintRequests;
                     else
                         fingerprintRequests = -10000; // fingerprint queried on incorrect path

+ 2 - 2
test/testremotediscovery.cpp

@@ -91,7 +91,7 @@ private slots:
         auto oldLocalState = fakeFolder.currentLocalState();
         auto oldRemoteState = fakeFolder.currentRemoteState();
 
-        QString errorFolder = "webdav/B";
+        QString errorFolder = "dav/B";
         QString fatalErrorPrefix = "Server replied with an error while reading directory 'B' : ";
         fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *)
                 -> QNetworkReply *{
@@ -133,7 +133,7 @@ private slots:
         //
         // Check the same discovery error on the sync root
         //
-        errorFolder = "webdav/";
+        errorFolder = "dav/";
         fatalErrorPrefix = "Server replied with an error while reading directory '' : ";
         errorSpy.clear();
         QVERIFY(!fakeFolder.syncOnce());

+ 26 - 26
test/testxmlparse.cpp

@@ -53,7 +53,7 @@ private slots:
         const QByteArray testXml = "<?xml version='1.0' encoding='utf-8'?>"
               "<d:multistatus xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\" xmlns:oc=\"http://owncloud.org/ns\">"
               "<d:response>"
-              "<d:href>/oc/remote.php/webdav/sharefolder/</d:href>"
+              "<d:href>/oc/remote.php/dav/sharefolder/</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004213ocobzus5kn6s</oc:id>"
@@ -77,7 +77,7 @@ private slots:
               "</d:propstat>"
               "</d:response>"
               "<d:response>"
-              "<d:href>/oc/remote.php/webdav/sharefolder/quitte.pdf</d:href>"
+              "<d:href>/oc/remote.php/dav/sharefolder/quitte.pdf</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004215ocobzus5kn6s</oc:id>"
@@ -110,16 +110,16 @@ private slots:
                  this, SLOT(slotFinishedSuccessfully()) );
 
         QHash <QString, ExtraFolderInfo> sizes;
-        QVERIFY(parser.parse( testXml, &sizes, "/oc/remote.php/webdav/sharefolder" ));
+        QVERIFY(parser.parse( testXml, &sizes, "/oc/remote.php/dav/sharefolder" ));
 
         QVERIFY(_success);
         QCOMPARE(sizes.size(), 1 ); // Quota info in the XML
 
-        QVERIFY(_items.contains("/oc/remote.php/webdav/sharefolder/quitte.pdf"));
-        QVERIFY(_items.contains("/oc/remote.php/webdav/sharefolder"));
+        QVERIFY(_items.contains("/oc/remote.php/dav/sharefolder/quitte.pdf"));
+        QVERIFY(_items.contains("/oc/remote.php/dav/sharefolder"));
         QVERIFY(_items.size() == 2 );
 
-        QVERIFY(_subdirs.contains("/oc/remote.php/webdav/sharefolder/"));
+        QVERIFY(_subdirs.contains("/oc/remote.php/dav/sharefolder/"));
         QVERIFY(_subdirs.size() == 1);
     }
 
@@ -127,7 +127,7 @@ private slots:
         const QByteArray testXml = "X<?xml version='1.0' encoding='utf-8'?>"
               "<d:multistatus xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\" xmlns:oc=\"http://owncloud.org/ns\">"
               "<d:response>"
-              "<d:href>/oc/remote.php/webdav/sharefolder/</d:href>"
+              "<d:href>/oc/remote.php/dav/sharefolder/</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004213ocobzus5kn6s</oc:id>"
@@ -151,7 +151,7 @@ private slots:
               "</d:propstat>"
               "</d:response>"
               "<d:response>"
-              "<d:href>/oc/remote.php/webdav/sharefolder/quitte.pdf</d:href>"
+              "<d:href>/oc/remote.php/dav/sharefolder/quitte.pdf</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004215ocobzus5kn6s</oc:id>"
@@ -184,7 +184,7 @@ private slots:
                  this, SLOT(slotFinishedSuccessfully()) );
 
         QHash <QString, ExtraFolderInfo> sizes;
-        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/webdav/sharefolder" )); // verify false
+        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/dav/sharefolder" )); // verify false
 
         QVERIFY(!_success);
         QVERIFY(sizes.size() == 0 ); // No quota info in the XML
@@ -207,7 +207,7 @@ private slots:
                  this, SLOT(slotFinishedSuccessfully()) );
 
         QHash <QString, ExtraFolderInfo> sizes;
-        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/webdav/sharefolder" )); // verify false
+        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/dav/sharefolder" )); // verify false
 
         QVERIFY(!_success);
         QVERIFY(sizes.size() == 0 ); // No quota info in the XML
@@ -229,7 +229,7 @@ private slots:
                  this, SLOT(slotFinishedSuccessfully()) );
 
         QHash <QString, ExtraFolderInfo> sizes;
-        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/webdav/sharefolder" )); // verify false
+        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/dav/sharefolder" )); // verify false
 
         QVERIFY(!_success);
         QVERIFY(sizes.size() == 0 ); // No quota info in the XML
@@ -242,7 +242,7 @@ private slots:
         const QByteArray testXml = "<?xml version='1.0' encoding='utf-8'?>"
               "<d:multistatus xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\" xmlns:oc=\"http://owncloud.org/ns\">"
               "<d:response>"
-              "<d:href>/oc/remote.php/webdav/sharefolder/</d:href>"
+              "<d:href>/oc/remote.php/dav/sharefolder/</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004213ocobzus5kn6s</oc:id>"
@@ -268,7 +268,7 @@ private slots:
                  this, SLOT(slotFinishedSuccessfully()) );
 
         QHash <QString, ExtraFolderInfo> sizes;
-        QVERIFY(!parser.parse( testXml, &sizes, "/oc/remote.php/webdav/sharefolder" ));
+        QVERIFY(!parser.parse( testXml, &sizes, "/oc/remote.php/dav/sharefolder" ));
         QVERIFY(!_success);
     }
 
@@ -276,7 +276,7 @@ private slots:
         const QByteArray testXml = "<?xml version='1.0' encoding='utf-8'?>"
               "<d:multistatus xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\" xmlns:oc=\"http://owncloud.org/ns\">"
               "<d:response>"
-              "<d:href>http://127.0.0.1:81/oc/remote.php/webdav/sharefolder/</d:href>"
+              "<d:href>http://127.0.0.1:81/oc/remote.php/dav/sharefolder/</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004213ocobzus5kn6s</oc:id>"
@@ -300,7 +300,7 @@ private slots:
               "</d:propstat>"
               "</d:response>"
               "<d:response>"
-              "<d:href>http://127.0.0.1:81/oc/remote.php/webdav/sharefolder/quitte.pdf</d:href>"
+              "<d:href>http://127.0.0.1:81/oc/remote.php/dav/sharefolder/quitte.pdf</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004215ocobzus5kn6s</oc:id>"
@@ -333,7 +333,7 @@ private slots:
                  this, SLOT(slotFinishedSuccessfully()) );
 
         QHash <QString, ExtraFolderInfo> sizes;
-        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/webdav/sharefolder" ));
+        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/dav/sharefolder" ));
         QVERIFY(!_success);
     }
 
@@ -398,7 +398,7 @@ private slots:
                  this, SLOT(slotFinishedSuccessfully()) );
 
         QHash <QString, ExtraFolderInfo> sizes;
-        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/webdav/sharefolder" ));
+        QVERIFY(false == parser.parse( testXml, &sizes, "/oc/remote.php/dav/sharefolder" ));
         QVERIFY(!_success);
     }
 
@@ -406,7 +406,7 @@ private slots:
         const QByteArray testXml = "<?xml version='1.0' encoding='utf-8'?>"
               "<d:multistatus xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\" xmlns:oc=\"http://owncloud.org/ns\">"
               "<d:response>"
-              "<d:href>/oc/remote.php/webdav/sharefolder/</d:href>"
+              "<d:href>/oc/remote.php/dav/sharefolder/</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004213ocobzus5kn6s</oc:id>"
@@ -430,7 +430,7 @@ private slots:
               "</d:propstat>"
               "</d:response>"
               "<d:response>"
-              "<d:href>/oc/remote.php/webdav/sharefolder/../sharefolder/quitte.pdf</d:href>"
+              "<d:href>/oc/remote.php/dav/sharefolder/../sharefolder/quitte.pdf</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004215ocobzus5kn6s</oc:id>"
@@ -463,16 +463,16 @@ private slots:
                  this, SLOT(slotFinishedSuccessfully()) );
 
         QHash <QString, ExtraFolderInfo> sizes;
-        QVERIFY(parser.parse( testXml, &sizes, "/oc/remote.php/webdav/sharefolder" ));
+        QVERIFY(parser.parse( testXml, &sizes, "/oc/remote.php/dav/sharefolder" ));
 
         QVERIFY(_success);
         QCOMPARE(sizes.size(), 1 ); // Quota info in the XML
 
-        QVERIFY(_items.contains("/oc/remote.php/webdav/sharefolder/quitte.pdf"));
-        QVERIFY(_items.contains("/oc/remote.php/webdav/sharefolder"));
+        QVERIFY(_items.contains("/oc/remote.php/dav/sharefolder/quitte.pdf"));
+        QVERIFY(_items.contains("/oc/remote.php/dav/sharefolder"));
         QVERIFY(_items.size() == 2 );
 
-        QVERIFY(_subdirs.contains("/oc/remote.php/webdav/sharefolder/"));
+        QVERIFY(_subdirs.contains("/oc/remote.php/dav/sharefolder/"));
         QVERIFY(_subdirs.size() == 1);
     }
 
@@ -480,7 +480,7 @@ private slots:
         const QByteArray testXml = "<?xml version='1.0' encoding='utf-8'?>"
               "<d:multistatus xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\" xmlns:oc=\"http://owncloud.org/ns\">"
               "<d:response>"
-              "<d:href>/oc/remote.php/webdav/sharefolder/</d:href>"
+              "<d:href>/oc/remote.php/dav/sharefolder/</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004213ocobzus5kn6s</oc:id>"
@@ -504,7 +504,7 @@ private slots:
               "</d:propstat>"
               "</d:response>"
               "<d:response>"
-              "<d:href>/oc/remote.php/webdav/sharefolder/../quitte.pdf</d:href>"
+              "<d:href>/oc/remote.php/dav/sharefolder/../quitte.pdf</d:href>"
               "<d:propstat>"
               "<d:prop>"
               "<oc:id>00004215ocobzus5kn6s</oc:id>"
@@ -537,7 +537,7 @@ private slots:
                  this, SLOT(slotFinishedSuccessfully()) );
 
         QHash <QString, ExtraFolderInfo> sizes;
-        QVERIFY(!parser.parse( testXml, &sizes, "/oc/remote.php/webdav/sharefolder" ));
+        QVERIFY(!parser.parse( testXml, &sizes, "/oc/remote.php/dav/sharefolder" ));
 
         QVERIFY(!_success);
     }