From 7750a8aa06908224bd3aa3e387999d765f6d9fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6ll?= Date: Tue, 25 Feb 2025 10:37:45 +0100 Subject: [PATCH 1/2] fix: allow 404 status code in OPTIONS request for WebDAV auth Some WebDAV servers return a 404 status for the OPTIONS request if the endpoint is not explicitly configured, even though authentication may still be valid. Previously, the implementation only allowed a 200 response and threw an error otherwise. This fix updates the authentication check to also accept 404, preventing unnecessary authentication failures and improving compatibility with a wider range of WebDAV servers. --- lib/src/webdav_dio.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/webdav_dio.dart b/lib/src/webdav_dio.dart index 157623c..a49dfc5 100644 --- a/lib/src/webdav_dio.dart +++ b/lib/src/webdav_dio.dart @@ -249,7 +249,7 @@ class WdDio with DioMixin implements Dio { }) async { // fix auth error var pResp = await this.wdOptions(self, path, cancelToken: cancelToken); - if (pResp.statusCode != 200) { + if ((pResp.statusCode != 200) && (pResp.statusCode != 404)) { throw newResponseError(pResp); } @@ -291,7 +291,7 @@ class WdDio with DioMixin implements Dio { }) async { // fix auth error var pResp = await this.wdOptions(self, path, cancelToken: cancelToken); - if (pResp.statusCode != 200) { + if ((pResp.statusCode != 200) && (pResp.statusCode != 404)) { throw newResponseError(pResp); } @@ -457,7 +457,7 @@ class WdDio with DioMixin implements Dio { }) async { // fix auth error var pResp = await this.wdOptions(self, path, cancelToken: cancelToken); - if (pResp.statusCode != 200) { + if ((pResp.statusCode != 200) && (pResp.statusCode != 404)) { throw newResponseError(pResp); } @@ -492,7 +492,7 @@ class WdDio with DioMixin implements Dio { }) async { // fix auth error var pResp = await this.wdOptions(self, path, cancelToken: cancelToken); - if (pResp.statusCode != 200) { + if ((pResp.statusCode != 200) && (pResp.statusCode != 404)) { throw newResponseError(pResp); } From a910c73004977ac54860d1d3738fbfe5c737dfd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6ll?= Date: Fri, 22 May 2026 11:22:51 +0200 Subject: [PATCH 2/2] chore(dep): updated xml dependency --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index d5293e8..76902ec 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: dio: ^5.1.0 - xml: ^6.2.2 + xml: ^7.0.1 convert: ^3.1.1 dev_dependencies: