File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
55import { getCurrentUser } from '@nextcloud/auth'
6+ import { getCapabilities } from '@nextcloud/capabilities'
67import logger from '../utils/logger'
78
89export type DavProperty = { [ key : string ] : string }
@@ -146,6 +147,9 @@ export const getFavoritesReport = function(): string {
146147 * ```
147148 */
148149export const getRecentSearch = function ( lastModified : number ) : string {
150+ const capabilities = getCapabilities ( ) as { dav ?: { search_supports_upload_time ?: boolean } }
151+ const supportsUploadTime = capabilities . dav ?. search_supports_upload_time
152+
149153 return `<?xml version="1.0" encoding="UTF-8"?>
150154<d:searchrequest ${ getDavNameSpaces ( ) }
151155 xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
@@ -179,12 +183,31 @@ export const getRecentSearch = function(lastModified: number): string {
179183 <d:literal>0</d:literal>
180184 </d:eq>
181185 </d:or>
182- <d:gt>
183- <d:prop>
184- <d:getlastmodified/>
185- </d:prop>
186- <d:literal>${ lastModified } </d:literal>
187- </d:gt>
186+ ${ supportsUploadTime
187+ ? `
188+ <d:or>
189+ <d:gt>
190+ <d:prop>
191+ <d:getlastmodified/>
192+ </d:prop>
193+ <d:literal>${ lastModified } </d:literal>
194+ </d:gt>
195+ <d:gt>
196+ <d:prop>
197+ <nc:upload_time/>
198+ </d:prop>
199+ <d:literal>${ lastModified } </d:literal>
200+ </d:gt>
201+ </d:or>
202+ `
203+ : `
204+ <d:gt>
205+ <d:prop>
206+ <d:getlastmodified/>
207+ </d:prop>
208+ <d:literal>${ lastModified } </d:literal>
209+ </d:gt>
210+ ` }
188211 </d:and>
189212 </d:where>
190213 <d:orderby>
You can’t perform that action at this time.
0 commit comments