mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-25 17:03:52 +00:00
feat(webdav): disable CapacitorHttp for unsupported methods and use original fetch function
This commit is contained in:
parent
49f31e93fc
commit
932ce2aed3
1 changed files with 7 additions and 14 deletions
|
|
@ -47,19 +47,9 @@ export class WebdavApi {
|
|||
constructor(private _getCfgOrError: () => Promise<WebdavPrivateCfg>) {}
|
||||
|
||||
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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue