[Bugfix:Submission] Dot File Upload#12924
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12924 +/- ##
============================================
- Coverage 21.40% 21.40% -0.01%
- Complexity 9944 9945 +1
============================================
Files 268 268
Lines 37124 37127 +3
Branches 494 494
============================================
Hits 7948 7948
- Misses 28686 28689 +3
Partials 490 490
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
GarvitKhandelwal31
left a comment
There was a problem hiding this comment.
I believe that let's not just create an array deep inside a file, the better method should be to make a utility function in site/app/libraries/FileUtils.php so that any other file can also use this logic. This would ensure that we have one place where we have defined all the metafiles there is.
Also I think there are more metafiles than that is included in this PR currently.
Thank you for the feedback, if you know any other metafiles may you please let me know them. |
More files that I can see missing-
|
GarvitKhandelwal31
left a comment
There was a problem hiding this comment.
The code changes looks good to me, I propose something more-
There are two more files that I could find that uses the same logic of comparing these metafiles by hardcoding-
- site/app/views/grading/ElectronicGraderView.php (around line 1124-1130)
- site/app/models/gradeable/Gradeable.php (around 739-746)
These maybe unrelated to what issue you are solving by this PR, but I think it will be just simple changes.
@GarvitKhandelwal31 I have added the use of the function into these files as well. |
| $pattern_match_flag = false; | ||
| foreach ($display_version_instance->getFiles()["submissions"] as $key => $value) { | ||
| if ($pattern1 !== $key && !preg_match($pattern2, $key) && !preg_match($pattern3, $key) && $pattern4 !== $key && $pattern5 !== $key) { | ||
| if (!FileUtils::isSubmissionMetaFile($key)) { |
There was a problem hiding this comment.
You forgot to check for upload.pdf (or pattern 1 in this case), in this if condition just compare for upload.pdf also
| const IGNORE_FILES = ['.ds_store']; | ||
| const ALLOWED_IMAGE_TYPES = ['jpg', 'jpeg', 'png', 'gif']; | ||
| const SUBMISSION_META_FILES = ['.submit.notebook', '.submit.timestamp', '.submit.VCS_CHECKOUT', | ||
| '.user_assignment_access.json', '.bulk_upload_data.json', '.upload.pdf']; |
There was a problem hiding this comment.
remove .upload.pdf
There was a problem hiding this comment.
So I should remove .upload.pdf and keep the extra conditions from before in the ElectronicGraderView?
There was a problem hiding this comment.
Yes remove .upload.pdf from the metafiles array, and in the ElectronicGraderView.php comapre inside 'if' condition only
| $pattern_match_flag = false; | ||
| foreach ($display_version_instance->getFiles()["submissions"] as $key => $value) { | ||
| if ($pattern1 !== $key && !preg_match($pattern2, $key) && !preg_match($pattern3, $key) && $pattern4 !== $key && $pattern5 !== $key) { | ||
| if (!FileUtils::isSubmissionMetaFile($key) && $key !== '.upload.pdf') { |
There was a problem hiding this comment.
Oops, just one thing, you need to compare with "upload.pdf" , not ".upload.pdf" . If I am not wrong, .upload.pdf is no metafile. Please verify it from Barb too :)
There was a problem hiding this comment.
Fixed :)
bmcutler
left a comment
There was a problem hiding this comment.
Code looks good to me. List of file looks good, thanks for collecting them in one place.
experimental change that copies over the dotfile logic from recent PR Submitty#12924. The original logic is in PHP, so the easiest way to make it accessible was to copy it over into JS, but there are probably better solutions that I'll be discussing at the meeting today.
### Why is this Change Important & Necessary? Fixes Submitty#12920. Currently when a student submits a file that begins with a '.' it automatically gets flagged, and will appear blank in Submitted Files. ### What is the New Behavior? Only known meta data files, should be hidden for safety purposes. These files are now the ones that will get automatically flagged rather than a file that begins with a '.' ### What steps should a reviewer take to reproduce or test the bug or new feature? Main: - Submitted a dotfile (.hidden) to a gradeable. - Verified the file was treated as a metadata file and did not appear in the Submitted Files panel. Fix: - Submitted dotfiles (.hidden and .text) to a gradeable. - Verified the files appeared in the Submitted Files panel. - Verified the files could be downloaded individually. - Verified Download All Files included the submitted dotfiles. ### Automated Testing & Documentation N/A ### Other information N/A --------- Co-authored-by: Nick Ciuica <[email protected]>
* main: (78 commits) [Bugfix:TAGrading] Auto-open single file (#12625) [Feature:InstructorUI] Add sortable columns to manage students (#12957) [Dependency] Bump php-ds/php-ds from 1.7.0 to 2.0.1 in /site (#12827) [Refactor:TAGrading] Events Infrastructure & StatusBanner (#12941) [Dependency] Bump sqlalchemy from 2.0.48 to 2.0.51 in /.setup/pip (#12884) [Bugfix:Developer] trust hashicorp for vagrant install (#12968) [Feature:TAGrading] Backend for submission clustering (#12886) [Bugfix:InstructorUI] Missing Subsection in the Edit User form (#12955) [Bugfix:Submission] Warning Banners Accessibility Fix (#12956) [Bugfix:System] Preserve signup fields (#12939) [Bugfix:InstructorUI] Fix Csv Download of Subsections (#12954) [Bugfix:InstructorUI] Fix Manage Students Toggle Columns (#12953) [Feature:TAGrading] Persistent Auto-Open (#12931) [Bugfix:Submission] Dot File Upload (#12924) [Refactor:System] Declutter workers (#12815) [Bugfix:Developer] save/restore autograding_containers.json (#12952) [Bugfix:InstructorUI] Create Course Validation (#12949) [Testing:Notifications] Fix grade_inquiries.spec.js (#12950) [UI/UX:System] Add fullscreen button vue component (#12936) [Bugfix:TAGrading] Student Name Resize (#12946) ... # Conflicts: # .pylintrc

Why is this Change Important & Necessary?
Fixes #12920. Currently when a student submits a file that begins with a '.' it automatically gets flagged, and will appear blank in Submitted Files.
What is the New Behavior?
Only known meta data files, should be hidden for safety purposes. These files are now the ones that will get automatically flagged rather than a file that begins with a '.'
What steps should a reviewer take to reproduce or test the bug or new feature?
Main:
Fix:
Automated Testing & Documentation
N/A
Other information
N/A