fix(files): escape html entities in dav search requests

Signed-off-by: Kent Delante <kent@delante.me>

This fixes a 'xmlParseEntityRef: no name' error returned when
searching in files navigation while in folders with special characters
in the name.
This commit is contained in:
Kent Delante 2026-04-23 22:51:07 +08:00
parent b99a4373b9
commit f477d37e6e

View file

@ -10,6 +10,7 @@ import { getCurrentUser } from '@nextcloud/auth'
import { defaultRootPath, getDavNameSpaces, getDavProperties, resultToNode } from '@nextcloud/files/dav'
import { getBaseUrl } from '@nextcloud/router'
import { client } from './WebdavClient.ts'
import escapeHTML from 'escape-html'
import logger from '../logger.ts'
export interface SearchNodesOptions {
@ -56,7 +57,7 @@ export async function searchNodes(query: string, { dir, signal }: SearchNodesOpt
</d:select>
<d:from>
<d:scope>
<d:href>/files/${user.uid}${dir || ''}</d:href>
<d:href>/files/${user.uid}${dir ? escapeHTML(dir) : ''}</d:href>
<d:depth>infinity</d:depth>
</d:scope>
</d:from>