Commit a1550bf
committed
fix(upload): validate file size before FilenameValidator in FileUploadHelper
The FilenameValidator check calls \OCP\Server::get() which has no DI
container in unit-test context and throws an unexpected exception. Because
that check came before the size check, the \OCP\Util::uploadLimit() branch
was never reached, @Unlink was never called, and the temp file survived –
breaking testValidateUploadedFileTooBig.
Moving the size check earlier also makes semantic sense: rejecting oversized
files is cheap and should happen before any filename-policy evaluation.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>1 parent a9e38fb commit a1550bf
1 file changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
| 41 | + | |
43 | 42 | | |
44 | | - | |
| 43 | + | |
45 | 44 | | |
46 | 45 | | |
47 | | - | |
| 46 | + | |
| 47 | + | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
0 commit comments