fix(webdav): bump storage usage on PUT, not just REST multipart upload

update_file_streaming_with_perms (the method behind every WebDAV/
NextCloud/WOPI PUT) never called the storage-usage-delta hook, so
drives.used_bytes and the RFC 4331 quota-used-bytes property never
reflected content written via WebDAV — only the REST multipart
upload path bumped usage. Extract apply_storage_usage_delta() from
maybe_update_storage_usage() and wire it into both branches: the
overwrite path applies new_size - old_size, the create path applies
the full size.

Also fixes the two RFC 4331 hurl tests that caught this:
nc_webdav_quota_properties.hurl had a Hurl parse error ([BasicAuth]
section keys can't mix literal+template, so the {user}~{folder}
composite marker is now pre-resolved via [Options] variable: before
being referenced as a single template), and both quota-properties
tests now retry the post-upload PROPFIND (matching the existing
drive_quota.hurl/user_envelope_quota.hurl pattern) since the delta
is applied fire-and-forget on a background task.
This commit is contained in:
M.Schmidt
2026-07-13 20:00:01 +02:00
parent 8a405af5e1
commit e5c8d89da9
3 changed files with 43 additions and 8 deletions
+15 -3
View File
@@ -120,8 +120,10 @@ ncq_root_folder_id: jsonpath "$.root_folder_id"
# ─────────────────────────────────────────────────────────────
PROPFIND {{base_url}}/remote.php/dav/files/{{ncq_nc_username}}~{{ncq_root_folder_id}}/
Depth: 0
[Options]
variable: ncq_composite_user={{ncq_nc_username}}~{{ncq_root_folder_id}}
[BasicAuth]
{{ncq_nc_username}}~{{ncq_root_folder_id}}: {{ncq_nc_password}}
{{ncq_composite_user}}: {{ncq_nc_password}}
HTTP 207
[Asserts]
@@ -135,8 +137,10 @@ xpath "number(//*[local-name()='quota-available-bytes'])" == 500
# ─────────────────────────────────────────────────────────────
PUT {{base_url}}/remote.php/dav/files/{{ncq_nc_username}}~{{ncq_root_folder_id}}/quota-probe.txt
Content-Type: text/plain
[Options]
variable: ncq_composite_user={{ncq_nc_username}}~{{ncq_root_folder_id}}
[BasicAuth]
{{ncq_nc_username}}~{{ncq_root_folder_id}}: {{ncq_nc_password}}
{{ncq_composite_user}}: {{ncq_nc_password}}
```
32-byte-ish payload for nc
```
@@ -144,10 +148,18 @@ Content-Type: text/plain
HTTP 201
# The drive-usage bump is fire-and-forget on a tokio task (see
# `file_upload_service.rs::maybe_update_storage_usage`), so retry
# until `used_bytes` catches up — same shape as `drive_quota.hurl`
# Step 5.
PROPFIND {{base_url}}/remote.php/dav/files/{{ncq_nc_username}}~{{ncq_root_folder_id}}/
Depth: 0
[Options]
variable: ncq_composite_user={{ncq_nc_username}}~{{ncq_root_folder_id}}
retry: 10
retry-interval: 200ms
[BasicAuth]
{{ncq_nc_username}}~{{ncq_root_folder_id}}: {{ncq_nc_password}}
{{ncq_composite_user}}: {{ncq_nc_password}}
HTTP 207
[Asserts]