Skip to content

Commit

Permalink
Set the X-Requested-With header on dav requests
Browse files Browse the repository at this point in the history
This will make sure the server knows it is a webserver request.
Hence we can also use this when federation is disabled.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Aug 27, 2020
1 parent 15012a4 commit 8108012
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
40 changes: 31 additions & 9 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.

3 changes: 3 additions & 0 deletions src/services/DavClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import webdav from 'webdav'
import axios from '@nextcloud/axios'
import { getRootPath, getToken, isPublic } from '../utils/davUtils'

// Add this so the server knows it is an request from the browserg
axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest'

// force our axios
const patcher = webdav.getPatcher()
patcher.patch('request', axios)
Expand Down

0 comments on commit 8108012

Please sign in to comment.