Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>tags/v28.0.0beta1
@@ -19,10 +19,12 @@ | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
* | |||
*/ | |||
import { createClient, getPatcher, RequestOptions } from 'webdav' | |||
import { request } from '../../../../node_modules/webdav/dist/node/request.js' | |||
import type { RequestOptions, Response } from 'webdav' | |||
import { createClient, getPatcher } from 'webdav' | |||
import { generateRemoteUrl } from '@nextcloud/router' | |||
import { getCurrentUser, getRequestToken } from '@nextcloud/auth' | |||
import { request } from 'webdav/dist/node/request.js' | |||
export const rootPath = `/files/${getCurrentUser()?.uid}` | |||
export const defaultRootUrl = generateRemoteUrl('dav' + rootPath) | |||
@@ -40,7 +42,10 @@ export const getClient = (rootUrl = defaultRootUrl) => { | |||
* @see https://github.com/perry-mitchell/webdav-client/blob/8d9694613c978ce7404e26a401c39a41f125f87f/source/request.ts | |||
*/ | |||
const patcher = getPatcher() | |||
patcher.patch('request', (options: RequestOptions) => { | |||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | |||
// @ts-ignore | |||
// https://github.com/perry-mitchell/hot-patcher/issues/6 | |||
patcher.patch('request', (options: RequestOptions): Promise<Response> => { | |||
if (options.headers?.method) { | |||
options.method = options.headers.method | |||
delete options.headers.method |
@@ -28,6 +28,7 @@ const ignorePatterns = [ | |||
'@nextcloud/vue', | |||
'ansi-regex', | |||
'char-regex', | |||
'is-svg', | |||
'splitpanes', | |||
'string-length', | |||
'strip-ansi', |
@@ -89,7 +89,7 @@ | |||
"vuedraggable": "^2.24.3", | |||
"vuex": "^3.6.2", | |||
"vuex-router-sync": "^5.0.0", | |||
"webdav": "^5.2.1" | |||
"webdav": "^5.2.2" | |||
}, | |||
"devDependencies": { | |||
"@babel/node": "^7.20.7", | |||
@@ -26313,9 +26313,9 @@ | |||
} | |||
}, | |||
"node_modules/webdav": { | |||
"version": "5.2.1", | |||
"resolved": "https://registry.npmjs.org/webdav/-/webdav-5.2.1.tgz", | |||
"integrity": "sha512-GY01OAoLbKeLhMvHjfe8CLU9JMI/WKuyc5OUGV1P7lXP5N16lmZNRStFfIYyn5CTlDagEgVocAKekCq9Hrj/MA==", | |||
"version": "5.2.2", | |||
"resolved": "https://registry.npmjs.org/webdav/-/webdav-5.2.2.tgz", | |||
"integrity": "sha512-CTnhTTKug7pKbMqcvrnGNr4rV9qhWXV1sLk1PpN4BOskqDT+cEfFx4Y4VlcFXUX6lSUFsQBm9Ka8+6dIe0doQQ==", | |||
"dependencies": { | |||
"@buttercup/fetch": "^0.1.1", | |||
"base-64": "^1.0.0", | |||
@@ -46961,9 +46961,9 @@ | |||
"optional": true | |||
}, | |||
"webdav": { | |||
"version": "5.2.1", | |||
"resolved": "https://registry.npmjs.org/webdav/-/webdav-5.2.1.tgz", | |||
"integrity": "sha512-GY01OAoLbKeLhMvHjfe8CLU9JMI/WKuyc5OUGV1P7lXP5N16lmZNRStFfIYyn5CTlDagEgVocAKekCq9Hrj/MA==", | |||
"version": "5.2.2", | |||
"resolved": "https://registry.npmjs.org/webdav/-/webdav-5.2.2.tgz", | |||
"integrity": "sha512-CTnhTTKug7pKbMqcvrnGNr4rV9qhWXV1sLk1PpN4BOskqDT+cEfFx4Y4VlcFXUX6lSUFsQBm9Ka8+6dIe0doQQ==", | |||
"requires": { | |||
"@buttercup/fetch": "^0.1.1", | |||
"base-64": "^1.0.0", |
@@ -115,7 +115,7 @@ | |||
"vuedraggable": "^2.24.3", | |||
"vuex": "^3.6.2", | |||
"vuex-router-sync": "^5.0.0", | |||
"webdav": "^5.2.1" | |||
"webdav": "^5.2.2" | |||
}, | |||
"devDependencies": { | |||
"@babel/node": "^7.20.7", |