Skip to content

Commit fb788c5

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 fb788c5

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

lib/dav/davProperties.ts

Lines changed: 23 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,31 @@ export function getRecentSearch(timestamp: number): string {
173177
<d:literal>0</d:literal>
174178
</d:eq>
175179
</d:or>
176-
<d:or>
180+
${supportsUploadTime
181+
? `
182+
<d:or>
183+
<d:gt>
184+
<d:prop>
185+
<d:getlastmodified/>
186+
</d:prop>
187+
<d:literal>${timestamp}</d:literal>
188+
</d:gt>
189+
<d:gt>
190+
<d:prop>
191+
<nc:upload_time/>
192+
</d:prop>
193+
<d:literal>${timestamp}</d:literal>
194+
</d:gt>
195+
</d:or>
196+
`
197+
: `
177198
<d:gt>
178199
<d:prop>
179200
<d:getlastmodified/>
180201
</d:prop>
181202
<d:literal>${timestamp}</d:literal>
182203
</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>
204+
`}
190205
</d:and>
191206
</d:where>
192207
<d:orderby>

0 commit comments

Comments
 (0)