Commit 83b1f92
fix(dav): only derive the write size from a PUT Content-Length
put() is not only reached by PUT. The chunked upload assembly step is a MOVE or
COPY of <upload>/.file: Directory::moveInto() and ::copyInto() only
short-circuit File and Directory sources at storage level, so a FutureFile
falls through to Tree::copyNode() -> createFile() -> put(), where the data is
the AssemblyStream of the uploaded chunks and the request itself carries no
body at all.
For those requests the Content-Length says nothing about the stream being
written. Clients that send "Content-Length: 0" there, Safari among them, made
File::put() hand a 0 to IWriteStreamStorage::writeStream(). Storages that only
measure the stream when they are given no size, ObjectStoreStorage among them,
then wrote an empty file while the request still answered 201, so the upload
looked successful and the file was silently empty.
The size comparison further down already restricts itself to PUT for exactly
this reason. Apply the same restriction when deriving the expected size, which
covers both the MOVE and the COPY variant.
Genuine empty PUT uploads are unaffected: the method is still PUT, so a
Content-Length of 0 is passed through as before.
Signed-off-by: mostafa <mostafakhaki00@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 0d23f84 commit 83b1f92
2 files changed
Lines changed: 78 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
213 | 220 | | |
214 | 221 | | |
215 | 222 | | |
| |||
265 | 272 | | |
266 | 273 | | |
267 | 274 | | |
268 | | - | |
269 | 275 | | |
270 | 276 | | |
271 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
218 | 287 | | |
219 | 288 | | |
220 | 289 | | |
| |||
0 commit comments