Skip to content

[Bugfix:Submission] Dot File Upload#12924

Merged
bmcutler merged 13 commits into
mainfrom
fix-dot-files
Jun 26, 2026
Merged

[Bugfix:Submission] Dot File Upload#12924
bmcutler merged 13 commits into
mainfrom
fix-dot-files

Conversation

@dandrecollins07-ctrl

Copy link
Copy Markdown
Contributor

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:

  • 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

@github-project-automation github-project-automation Bot moved this to Seeking Reviewer in Submitty Development Jun 17, 2026
@dandrecollins07-ctrl dandrecollins07-ctrl changed the title [Bug:fix] Dot File Upload Handling [Bugfix] Dot File Upload Handling Jun 17, 2026
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.40%. Comparing base (75511e4) to head (a8b2da0).

Additional details and impacted files

Impacted file tree graph

@@             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              
Flag Coverage Δ
autograder 21.16% <ø> (ø)
js 2.01% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.44% <0.00%> (-0.01%) ⬇️
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dandrecollins07-ctrl dandrecollins07-ctrl changed the title [Bugfix] Dot File Upload Handling [Bugfix:Submission] Dot File Upload Jun 17, 2026

@GarvitKhandelwal31 GarvitKhandelwal31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Jun 19, 2026
@dandrecollins07-ctrl

Copy link
Copy Markdown
Contributor Author

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.

@GarvitKhandelwal31

Copy link
Copy Markdown
Contributor

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-

  1. .bulk_upload_data.json
  2. .upload_page_XX and .upload_version_XX (these are generated during bulk upload and have variable naming) (for these files we will have to do a prefix match)

@GarvitKhandelwal31 GarvitKhandelwal31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-

  1. site/app/views/grading/ElectronicGraderView.php (around line 1124-1130)
  2. 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.

@dandrecollins07-ctrl

Copy link
Copy Markdown
Contributor Author

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-

  1. site/app/views/grading/ElectronicGraderView.php (around line 1124-1130)
  2. 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)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to check for upload.pdf (or pattern 1 in this case), in this if condition just compare for upload.pdf also

Comment thread site/app/libraries/FileUtils.php Outdated
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'];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove .upload.pdf

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I should remove .upload.pdf and keep the extra conditions from before in the ElectronicGraderView?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes remove .upload.pdf from the metafiles array, and in the ElectronicGraderView.php comapre inside 'if' condition only

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@GarvitKhandelwal31 GarvitKhandelwal31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me, I also tested the issue the PR is targeting and it correctly solves that. On this branch when I submit .hidden.pdf it is correctly appearing in the submitted files section.

Image

@github-project-automation github-project-automation Bot moved this from Work in Progress to Awaiting Maintainer Review in Submitty Development Jun 23, 2026
$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') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)

@bmcutler bmcutler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. List of file looks good, thanks for collecting them in one place.

@bmcutler
bmcutler merged commit 6d26cc4 into main Jun 26, 2026
25 of 27 checks passed
@bmcutler
bmcutler deleted the fix-dot-files branch June 26, 2026 02:34
NicholasCiuica added a commit to NiharikaSaxena18/Submitty that referenced this pull request Jun 26, 2026
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.
jndlansh pushed a commit to jndlansh/Submitty that referenced this pull request Jul 1, 2026
### 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]>
prestoncarman added a commit that referenced this pull request Jul 1, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bugfix] Student dotfiles are incorrectly treated as Submitty metadata files

4 participants