diff --git a/packages/nextcloud/lib/src/api/webdav/webdav_client.dart b/packages/nextcloud/lib/src/api/webdav/webdav_client.dart index df65f716754..e69e7b0ea21 100644 --- a/packages/nextcloud/lib/src/api/webdav/webdav_client.dart +++ b/packages/nextcloud/lib/src/api/webdav/webdav_client.dart @@ -590,12 +590,11 @@ class WebDavClient extends DynamiteClient { /// /// The props in [set] will be added/updated. /// The props in [remove] will be removed. - /// Returns true if the update was successful. /// /// See: /// * http://www.webdav.org/specs/rfc2518.html#METHOD_PROPPATCH for more information. /// * [proppatch_Request] for the request sent by this method. - Future proppatch( + Future proppatch( PathUri path, { WebDavProp? set, WebDavPropWithoutValues? remove, @@ -612,15 +611,7 @@ class WebDavClient extends DynamiteClient { throw DynamiteStatusCodeException(response); } - final data = const WebDavResponseConverter().convert(response); - for (final a in data.responses) { - for (final b in a.propstats) { - if (!b.status.contains('200')) { - return false; - } - } - } - return true; + return const WebDavResponseConverter().convert(response); } /// Returns a request to move the resource from [sourcePath] to [destinationPath]. diff --git a/packages/nextcloud/test/api/webdav/webdav_test.dart b/packages/nextcloud/test/api/webdav/webdav_test.dart index 1e68037e47f..27f06348af8 100644 --- a/packages/nextcloud/test/api/webdav/webdav_test.dart +++ b/packages/nextcloud/test/api/webdav/webdav_test.dart @@ -409,13 +409,16 @@ void main() { created: createdDate, ); - final updated = await tester.client.webdav.proppatch( + final response = await tester.client.webdav.proppatch( PathUri.parse('test/set-props.txt'), set: const WebDavProp( ocFavorite: true, ), ); - expect(updated, isTrue); + expect( + response.responses.where((r) => r.propstats.where((ps) => !ps.status.contains('200 OK')).isNotEmpty), + isEmpty, + ); final props = (await tester.client.webdav.propfind( PathUri.parse('test/set-props.txt'), @@ -440,13 +443,16 @@ void main() { test('Remove properties', () async { await tester.client.webdav.put(utf8.encode('test'), PathUri.parse('test/remove-props.txt')); - var updated = await tester.client.webdav.proppatch( + var response = await tester.client.webdav.proppatch( PathUri.parse('test/remove-props.txt'), set: const WebDavProp( ocFavorite: true, ), ); - expect(updated, isTrue); + expect( + response.responses.where((r) => r.propstats.where((ps) => !ps.status.contains('200 OK')).isNotEmpty), + isEmpty, + ); var props = (await tester.client.webdav.propfind( PathUri.parse('test/remove-props.txt'), @@ -463,13 +469,16 @@ void main() { .prop; expect(props.ocFavorite, true); - updated = await tester.client.webdav.proppatch( + response = await tester.client.webdav.proppatch( PathUri.parse('test/remove-props.txt'), remove: const WebDavPropWithoutValues.fromBools( ocFavorite: true, ), ); - expect(updated, isFalse); + expect( + response.responses.where((r) => r.propstats.where((ps) => !ps.status.contains('200 OK')).isNotEmpty), + isNotEmpty, + ); props = (await tester.client.webdav.propfind( PathUri.parse('test/remove-props.txt'), @@ -491,15 +500,18 @@ void main() { PathUri.parse('test/tags.txt'), ); - final updated = await tester.client.webdav.proppatch( + var response = await tester.client.webdav.proppatch( PathUri.parse('test/tags.txt'), set: const WebDavProp( ocTags: WebDavOcTags(tags: ['example']), ), ); - expect(updated, isTrue); + expect( + response.responses.where((r) => r.propstats.where((ps) => !ps.status.contains('200 OK')).isNotEmpty), + isEmpty, + ); - final response = await tester.client.webdav.propfind( + response = await tester.client.webdav.propfind( PathUri.parse('test/tags.txt'), prop: const WebDavPropWithoutValues.fromBools( ocTags: true,