Skip to content

Commit

Permalink
Send CSRF token in rawStat
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Jul 10, 2023
1 parent f707694 commit c06090d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/services/FileInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import { getClient } from './WebdavClient'
import { genFileInfo, type FileInfo } from '../utils/fileUtils'
import { createClient, type FileStat, type ResponseDataDetailed } from 'webdav'
import { getRequestToken } from '@nextcloud/auth'

const statData = `<?xml version="1.0"?>
<d:propfind xmlns:d="DAV:"
Expand Down Expand Up @@ -53,6 +54,8 @@ const statData = `<?xml version="1.0"?>

/**
* Retrieve the files list
* @param path
* @param options
*/
export default async function(path: string, options = {}): Promise<FileInfo> {
const response = await getClient().stat(path, Object.assign({
Expand All @@ -64,9 +67,12 @@ export default async function(path: string, options = {}): Promise<FileInfo> {

/**
* Retrieve the files list
* @param origin
* @param path
* @param options
*/
export async function rawStat(origin: string, path: string, options = {}) {
const response = await createClient(origin).stat(path, {
const response = await createClient(origin, { headers: { requesttoken: getRequestToken() || '' } }).stat(path, {
...options,
data: statData,
details: true,
Expand Down

0 comments on commit c06090d

Please sign in to comment.