Skip to content

Commit 617efd3

Browse files
fix(recent-search): only use upload_time if on nc versions that suppport it
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
1 parent 304e6e6 commit 617efd3

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

lib/dav/davProperties.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ export function getFavoritesReport(): string {
140140
* ```
141141
*/
142142
export function getRecentSearch(timestamp: number): string {
143+
const major = Number.parseInt((window.OC?.config?.version ?? '0').split('.')[0])
144+
const patch = Number.parseInt((window.OC?.config?.version ?? '0').split('.')[2])
145+
const supportsUploadTime = major > 33 || (major === 33 && patch > 0)
146+
143147
return `<?xml version="1.0" encoding="UTF-8"?>
144148
<d:searchrequest ${getDavNameSpaces()}
145149
xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
@@ -173,20 +177,29 @@ export function getRecentSearch(timestamp: number): string {
173177
<d:literal>0</d:literal>
174178
</d:eq>
175179
</d:or>
176-
<d:or>
180+
${supportsUploadTime ? `
181+
<d:or>
182+
<d:gt>
183+
<d:prop>
184+
<d:getlastmodified/>
185+
</d:prop>
186+
<d:literal>${timestamp}</d:literal>
187+
</d:gt>
188+
<d:gt>
189+
<d:prop>
190+
<nc:upload_time/>
191+
</d:prop>
192+
<d:literal>${timestamp}</d:literal>
193+
</d:gt>
194+
</d:or>
195+
` : `
177196
<d:gt>
178197
<d:prop>
179198
<d:getlastmodified/>
180199
</d:prop>
181200
<d:literal>${timestamp}</d:literal>
182201
</d:gt>
183-
<d:gt>
184-
<d:prop>
185-
<nc:upload_time/>
186-
</d:prop>
187-
<d:literal>${timestamp}</d:literal>
188-
</d:gt>
189-
</d:or>
202+
`}
190203
</d:and>
191204
</d:where>
192205
<d:orderby>

0 commit comments

Comments
 (0)