Commit 4e2ef40
committed
fix(dav): keep part files when overwriting so an interrupted upload cannot destroy the target
The guard deciding whether a DAV write goes through a part file asked
View::isCreatable() about the part file path itself. isCreatable() answers
whether something can be created *inside* a path, so for a file that does not
exist yet it is always false and the guard collapsed to "skip the part file
whenever the target is updatable" - that is, for every overwrite. An upload
interrupted during assembly then truncated the user's existing file in place,
while oc_filecache kept asserting the previous size and etag, so no client had
any reason to re-fetch until a later occ files:scan turned the divergence into
a download of the empty file.
Ask isCreatable() about the directory that will hold the part file instead, and
keep the part file out of the two cases where it cannot stand in for the target:
- Part file names were always hashed, although the commit introducing the
hashing only meant to do so for names too long to fit. Encryption resolves a
part file's key by stripping the .ocTransferId suffix, which only leads back
to the target while the real name is kept, so a hashed name left an encrypted
overwrite undecryptable. Hash only when the name would overflow the
filesystem limit, and keep writing directly to the target when it must be.
- A single file share maps the target and nothing else, so a part file named
beside it lands on a different storage - the recipient's own, under their
quota - rather than next to the file being written.
Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>1 parent 9278886 commit 4e2ef40
4 files changed
Lines changed: 395 additions & 9 deletions
File tree
- apps/dav
- lib/Connector/Sabre
- tests/unit/Connector/Sabre
- RequestTest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
135 | 140 | | |
136 | 141 | | |
137 | 142 | | |
| 143 | + | |
138 | 144 | | |
139 | | - | |
| 145 | + | |
140 | 146 | | |
141 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
142 | 150 | | |
143 | 151 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | 152 | | |
149 | | - | |
150 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
151 | 157 | | |
| 158 | + | |
152 | 159 | | |
153 | 160 | | |
154 | 161 | | |
155 | | - | |
| 162 | + | |
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
159 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
160 | 185 | | |
161 | 186 | | |
162 | 187 | | |
| |||
412 | 437 | | |
413 | 438 | | |
414 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
415 | 446 | | |
416 | 447 | | |
417 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
1089 | 1090 | | |
1090 | 1091 | | |
1091 | 1092 | | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1092 | 1137 | | |
1093 | 1138 | | |
1094 | 1139 | | |
| |||
0 commit comments