From 932ce2aed37da9cde9aff8fc8d2e4fa5234a2939 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Fri, 13 Jun 2025 18:44:21 +0200 Subject: [PATCH] feat(webdav): disable CapacitorHttp for unsupported methods and use original fetch function --- .../api/sync/providers/webdav/webdav-api.ts | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/app/pfapi/api/sync/providers/webdav/webdav-api.ts b/src/app/pfapi/api/sync/providers/webdav/webdav-api.ts index 2ab68858b4..3f897226dc 100644 --- a/src/app/pfapi/api/sync/providers/webdav/webdav-api.ts +++ b/src/app/pfapi/api/sync/providers/webdav/webdav-api.ts @@ -47,19 +47,9 @@ export class WebdavApi { constructor(private _getCfgOrError: () => Promise) {} private _shouldUseCapacitorHttp(method: string): boolean { - if (!IS_ANDROID_WEB_VIEW) return false; - - const standardMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS']; - const shouldUse = !standardMethods.includes(method.toUpperCase()); - - pfLog(1, `${WebdavApi.L}._shouldUseCapacitorHttp() method check`, { - method, - isAndroidWebView: IS_ANDROID_WEB_VIEW, - isStandard: !shouldUse, - shouldUseCapacitor: shouldUse, - }); - - return shouldUse; + // Disable CapacitorHttp for now as it doesn't support PROPFIND/MKCOL + // and causes issues with the fetch interceptor + return false; } private async _makeCapacitorHttpRequest({ @@ -798,7 +788,10 @@ export class WebdavApi { }); try { - const response = await fetch(this._getUrl(path, cfg), { + // Use the original fetch function if available (bypasses Capacitor interceptor) + const fetchFunc = (globalThis as any).CapacitorWebFetch || fetch; + + const response = await fetchFunc(this._getUrl(path, cfg), { method, headers: requestHeaders, body,