Skip to content

Commit 118c2f8

Browse files
authored
[Bugfix:Submission] Bulk upload encode query params (Submitty#11228)
Fixes Submitty#11185 If a file uploaded by TA/instructor to a bulk upload pdf file gradeable contains a space in the filename, the error is unhelpful. ---------------------- In addition to space, we currently have the following disallowed characters, and I have included space as well: ![Screenshot 2024-12-04 042041](https://github.com/user-attachments/assets/c0ebefe3-d7cb-4173-b771-fe9b2dcf6345) Added documentation for filename requirements : ![Screenshot 2024-12-04 034250](https://github.com/user-attachments/assets/a7086f4e-9717-4eef-a68a-8835bfe6d0c7) Error message is also fixed : ![Screenshot 2024-12-04 042821](https://github.com/user-attachments/assets/d5bf33f0-fcb0-4bc1-88bf-ffa2c7e46e6f)
1 parent ffe7f75 commit 118c2f8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

site/app/controllers/student/SubmissionController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,13 @@ public function ajaxBulkUpload($gradeable_id) {
492492
// so we are using a python script via CGI to validate whether file is divisible by num_page or not.
493493
$pdf_full_path = FileUtils::joinPaths($pdf_path, $job_data["timestamp"], $job_data["filename"]);
494494
$ch = curl_init();
495-
curl_setopt($ch, CURLOPT_URL, $this->core->getConfig()->getCgiUrl() . "pdf_page_check.cgi?pdf_path={$pdf_full_path}&num_page={$num_pages}&file_name={$job_data['filename']}");
495+
curl_setopt($ch, CURLOPT_URL, $this->core->getConfig()->getCgiUrl() . "pdf_page_check.cgi?" . http_build_query(
496+
[
497+
'pdf_path' => $pdf_full_path,
498+
'num_page' => $num_pages,
499+
'file_name' => $job_data['filename']
500+
]
501+
));
496502
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
497503
$output = curl_exec($ch);
498504
curl_close($ch);

0 commit comments

Comments
 (0)