Commit f0ec9d0
authored
feat: convert datetime values to RFC 3339 in WebDAV search literals (#358)
This PR fixes incorrect handling of `datetime` and `date` objects in
WebDAV `find()` queries. Previously, passing a `datetime` resulted in an
invalid string format like `2025-03-10 12:34:56.123456`, causing
Nextcloud to misinterpret the value in `<d:literal>`.
**Changes made:**
- Added `_dav_literal()` helper to format datetime values as RFC 3339
strings (`2025-03-10T12:34:56Z`)
- Updated `build_search_req()` to use this helper when generating
`<d:literal>` values
This ensures proper comparison logic for operators like `"gt"` and
`"lt"` when filtering by `last_modified` or other time-based properties.
Fixes issues where files were incorrectly included or excluded due to
string-based comparison.
---------
Signed-off-by: bigcat88 <bigcat88@icloud.com>1 parent 62d104c commit f0ec9d0
2 files changed
+23
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
| |||
126 | 138 | | |
127 | 139 | | |
128 | 140 | | |
129 | | - | |
| 141 | + | |
130 | 142 | | |
131 | 143 | | |
132 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
753 | 753 | | |
754 | 754 | | |
755 | 755 | | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
756 | 765 | | |
757 | 766 | | |
758 | 767 | | |
| |||
0 commit comments