Skip to content

feat: convert datetime values to RFC 3339 in WebDAV search literals #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2025

Conversation

bigcat88
Copy link
Member

@bigcat88 bigcat88 commented May 1, 2025

Fixes #347 .

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>
Copy link

codecov bot commented May 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.14%. Comparing base (ebce575) to head (a6828a7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #358   +/-   ##
=======================================
  Coverage   95.13%   95.14%           
=======================================
  Files          45       45           
  Lines        5325     5333    +8     
=======================================
+ Hits         5066     5074    +8     
  Misses        259      259           
Files with missing lines Coverage Δ
nc_py_api/files/_files.py 98.65% <100.00%> (+0.05%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: bigcat88 <bigcat88@icloud.com>
@bigcat88 bigcat88 merged commit f0ec9d0 into main May 1, 2025
13 checks passed
@bigcat88 bigcat88 deleted the feat/dav/support-python-datetime branch May 1, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Finding files by modified date returns incorrect results
1 participant