Skip to content

Commit 13a3581

Browse files
committed
refactor(nextcloud): make csrf client wrapping optional.
Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
1 parent 2addc67 commit 13a3581

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

packages/nextcloud/lib/src/api/webdav/webdav_client.dart

+13-5
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,26 @@ final checksumPattern = RegExp(
2121
caseSensitive: false,
2222
);
2323

24-
/// WebDavClient class
24+
/// WebDavClient class.
2525
class WebDavClient extends DynamiteClient {
2626
/// Creates a new `WebDavClient`.
27+
///
28+
/// The [httpClient] parameter specifies whether requests should attach a
29+
/// CSRF-Token to sent requests.
30+
/// Until Nextcloud 30 this is required to work around an authorization bug
31+
/// triggered, when cookies are also sent.
2732
WebDavClient(
2833
super.baseURL, {
2934
http.Client? httpClient,
3035
super.authentications,
36+
bool useCSRFClient = true,
3137
}) : super(
32-
httpClient: WebDavCSRFClient(
33-
baseURL,
34-
httpClient: httpClient,
35-
),
38+
httpClient: useCSRFClient
39+
? WebDavCSRFClient(
40+
baseURL,
41+
httpClient: httpClient,
42+
)
43+
: httpClient,
3644
);
3745

3846
/// Creates a new [WebDavClient] from another [client].

0 commit comments

Comments
 (0)