aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-10-25 13:07:06 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-10-25 13:07:06 +0200
commit661756b02ac16594a2996da2809643e10fcfc748 (patch)
tree18182ba4ae1fcee5205eab4d5f3036940504f323 /apps/files_versions
parent24abfd8869a0e5abf3ca56d8546bfa7d12852056 (diff)
downloadnextcloud-server-661756b02ac16594a2996da2809643e10fcfc748.tar.gz
nextcloud-server-661756b02ac16594a2996da2809643e10fcfc748.zip
Set error expected by the DAV client for a failed move
A revert triggers a move in the DAV client, and the DAV client expects a DAV error message to be provided by the server in case of failure; if no error message is given the client ends trying to get an attribute from an undefined object and "crashes". Besides that, if the revert fails the "done" callback of the promise (the first parameter of "then") is never called, so a "fail" callback should be used instead. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/tests/js/versionmodelSpec.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/files_versions/tests/js/versionmodelSpec.js b/apps/files_versions/tests/js/versionmodelSpec.js
index d47e92e2b60..ae8801b1f5c 100644
--- a/apps/files_versions/tests/js/versionmodelSpec.js
+++ b/apps/files_versions/tests/js/versionmodelSpec.js
@@ -86,9 +86,17 @@ describe('OCA.Versions.VersionModel', function() {
});
expect(fakeServer.requests.length).toEqual(1);
- fakeServer.requests[0].respond(404);
+ var responseErrorHeaders = {
+ "Content-Type": "application/xml"
+ };
+ var responseErrorBody =
+ '<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">' +
+ ' <s:exception>Sabre\\DAV\\Exception\\SomeException</s:exception>' +
+ ' <s:message>Some error message</s:message>' +
+ '</d:error>';
+ fakeServer.requests[0].respond(404, responseErrorHeaders, responseErrorBody);
- promise.then(function() {
+ promise.fail(function() {
expect(revertEventStub.notCalled).toEqual(true);
expect(successStub.notCalled).toEqual(true);
expect(errorStub.calledOnce).toEqual(true);