File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -171,14 +171,20 @@ private function createSafeName(string $name): string
171171 * - If the request returns anything else, the chunk will be uploaded in the standard fashion.
172172 * (It is recommended to return 204 No Content in these cases if possible
173173 * to avoid unwarranted notices in browser consoles.)
174+ * - If this request returns a 422 HTTP code, one of the parameters is missing
174175 */
175176 public function handleTestChunk (): ResponseInterface
176177 {
177178 $ identifier = $ this ->resumableParam ($ this ->resumableOption ['identifier ' ]);
178179 $ filename = $ this ->resumableParam ($ this ->resumableOption ['filename ' ]);
179- $ chunkNumber = (int ) $ this ->resumableParam ($ this ->resumableOption ['chunkNumber ' ]);
180+ $ chunkNumber = $ this ->resumableParam ($ this ->resumableOption ['chunkNumber ' ]);
181+
182+ // A parameter is missing
183+ if ($ identifier === null || $ filename === null || $ chunkNumber === null ) {
184+ return $ this ->response ->withStatus (422 );
185+ }
180186
181- if ($ this ->isChunkUploaded ($ identifier , $ filename , $ chunkNumber )) {
187+ if ($ this ->isChunkUploaded ($ identifier , $ filename , ( int ) $ chunkNumber )) {
182188 // We have the chunk, do not send it
183189 return $ this ->response ->withStatus (200 );
184190 }
You can’t perform that action at this time.
0 commit comments