Skip to content

Commit

Permalink
Merge pull request #1797 from nextcloud/artonge/fix/send_csrf_token_w…
Browse files Browse the repository at this point in the history
…hen_fetching_updated_node

Send CSRF token in rawStat
  • Loading branch information
artonge authored Jul 10, 2023
2 parents f707694 + 2016523 commit 6f0f8f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

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 6f0f8f2

Please sign in to comment.