Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nil check for file manager #2147

Merged
merged 9 commits into from
Apr 20, 2024
Merged

Nil check for file manager #2147

merged 9 commits into from
Apr 20, 2024

Conversation

KesterTan
Copy link
Contributor

@KesterTan KesterTan commented Apr 15, 2024

Fixed nil check for file manager (https://nightly.autolabproject.com/file_manager/comptest/hello/autograde-Makefile)

Description

  • Opens and reads files that have no mimetype

How Has This Been Tested?

  • Upload a file that has no extensions like README and autograde-Makefile, check that when you click into it that the file opens and contents are displayed as text (no nil errors should occur)
  • Test that breadcrumbs and back button also work as expected

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have run rubocop and erblint for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting
  • My change requires a change to the documentation, which is located at Autolab Docs
  • I have updated the documentation accordingly, included in this PR

Copy link
Contributor

coderabbitai bot commented Apr 15, 2024

Walkthrough

Walkthrough

The recent updates aim to enhance the File Manager within the course management system. These improvements include refined file type handling in the controller and expanded features in the documentation for instructors. The changes are designed to improve user interaction with files, enforce new limits and standards, and enhance instructors' capabilities in course and file management.

Changes

File Path Change Summary
.../file_manager_controller.rb Updated file handling logic to better distinguish between binary and text files for appropriate actions.
docs/instructors.md Enhanced File Manager features detailed; added viewing and management capabilities for instructors, along with new file size limits and naming conventions.

Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 03f10ea and a320cde.
Files selected for processing (1)
  • docs/instructors.md (1 hunks)
Additional Context Used
LanguageTool (66)
docs/instructors.md (66)

Near line 3: Possible spelling mistake found.
Context: ...the basic ideas and capabilities of the Autolab system. It's meant to be read from begi...


Near line 7: Possible spelling mistake found.
Context: ...uctors opt to give some or all of their TAs instructor status. ## Roster The _ros...


Near line 11: Possible spelling mistake found.
Context: ... by uploading a CSV file in the general Autolab format: ``` Semester,email,last_name,f...


Near line 23: This sentence does not start with an uppercase letter.
Context: ...il","College","Department",... ``` !!! warning "Attention CMU Instructors:" S3 lis...


Near line 24: Put a space after the comma.
Context: ...ich lists the section letter (e.g., A, B,...) in the section field. Be careful not...


Near line 24: Possible spelling mistake found.
Context: ...re(s), and then upload a single file to Autolab with all of the sections. For the bulk...


Near line 24: Consider removing “of” to be more concise
Context: ...en upload a single file to Autolab with all of the sections. For the bulk upload, you can...


Near line 28: Possible spelling mistake found.
Context: ... new students in the roster file to the Autolab roster, or to 2. update the Autola...


Near line 30: This sentence does not start with an uppercase letter.
Context: ...file to the Autolab roster, or to 2. update the Autolab roster by marking student...


Near line 30: Possible spelling mistake found.
Context: ...utolab roster, or to 2. update the Autolab roster by marking students missing from...


Near line 32: Possible spelling mistake found.
Context: ... For a linked course, you can sync the Autolab roster by clicking the refresh button a...


Near line 36: Possible spelling mistake found.
Context: ... in the linked course as dropped on the Autolab roster. Instructors and course assist...


Near line 39: Possible spelling mistake found.
Context: ...ork and do not appear on the instructor gradebook. Instructors can change the dropped sta...


Near line 41: Possible spelling mistake found.
Context: ...ible to the student when they visit the Autolab site. A student can be enrolled in an a...


Near line 41: Possible spelling mistake found.
Context: ...n be enrolled in an arbitrary number of Autolab courses. ## Access Codes To allow stu...


Near line 53: Possible spelling mistake found.
Context: ...ng that your students make submissions (handins) for. This could be a programming assig...


Near line 59: Possible spelling mistake found.
Context: ..._, e.g., "Lab", "Exam", "Homework". ## Autograders and Scoreboards Labs can be _autograde...


Near line 61: Possible spelling mistake found.
Context: ...tograders and Scoreboards Labs can be autograded or not, at your discretion. When a stu...


Near line 61: Possible spelling mistake found.
Context: ...iscretion. When a student submits to an autograded lab, Autolab runs an instructor-supplie...


Near line 61: Possible spelling mistake found.
Context: ...b, Autolab runs an instructor-supplied autograder program that assigns scores to one or ...


Near line 61: Possible spelling mistake found.
Context: ... more problems associated with the lab. Autograded labs can have an optional scoreboard ...


Near line 61: Possible spelling mistake found.
Context: ... Authors](/lab/) for details on writing autograded labs with scoreboards. ## Important Da...


Near line 65: Before the countable noun ‘without’ an article or a possessive pronoun is necessary.
Context: ...s can submit until the due date without penalty or consuming grace days. Submissions ar...


Near line 67: Possible spelling mistake found.
Context: ...ns are disabled after the end date. ## Handins/Submissions Once an assessment is live...


Near line 69: Possible spelling mistake found.
Context: ...rt date), students can begin submitting handins, where each handin is a single file, wh...


Near line 69: Possible spelling mistake found.
Context: ...an begin submitting handins, where each handin is a single file, which can be either a...


Near line 69: The official name of this software platform is spelled with a capital “H”.
Context: ...repo's corresponding branch. Check here for how to set up and try ...


Near line 73: Possible spelling mistake found.
Context: ...structors to assign groups through the Autolab Frontend API. ## Penal...


Near line 73: Possible spelling mistake found.
Context: ...groups through the Autolab Frontend API. ## Penalties and Extensions You can...


Near line 77: Possible spelling mistake found.
Context: ...ensions You can set penalties for late handins, set hard limits on the number of handi...


Near line 77: Possible spelling mistake found.
Context: ...ndins, set hard limits on the number of handins, or set soft limits that penalize exces...


Near line 77: Possible spelling mistake found.
Context: ...set soft limits that penalize excessive handins on a sliding scale. You can also give a...


Near line 81: Possible spelling mistake found.
Context: ...dates for that student. ## Grace Days Autolab provides support for a late handin poli...


Near line 82: Possible spelling mistake found.
Context: ...ys Autolab provides support for a late handin policy based on grace days. Each stud...


Near line 82: Possible spelling mistake found.
Context: ... that are automatically applied if they handin after the due date. Each late day consu...


Near line 82: Possible spelling mistake found.
Context: ...mes one of the budgeted grace days. The Autolab system keeps track of the number of gra...


Near line 82: Possible spelling mistake found.
Context: .... If students run out of grace days and handin late, then there is a fixed late penalt...


Near line 92: Possible spelling mistake found.
Context: ...er the end date, or automatically by an autograder after each submission. Problem scores c...


Near line 98: Possible missing comma found.
Context: ...sments in a specific instructor-defined category such as "Labs, or "Exams". By default t...


Near line 98: Unpaired symbol: ‘"’ seems to be missing
Context: ...fic instructor-defined category such as "Labs, or "Exams". By default the categor...


Near line 98: Did you mean: “By default,”?
Context: ...ned category such as "Labs, or "Exams". By default the category average is the arithmetic ...


Near line 102: Possible spelling mistake found.
Context: ...o Grade" submission will show up in the gradebook as NG and a zero will be used when calc...


Near line 102: Possible missing comma found.
Context: ...ission will show up in the gradebook as NG and a zero will be used when calculatin...


Near line 102: Possible spelling mistake found.
Context: ...Excused" submission will show up in the gradebook as EXC and will not be used when calcul...


Near line 106: Possible spelling mistake found.
Context: ...lated by a default Ruby function called fooAverage, which you can override in the `course...


Near line 106: Possible spelling mistake found.
Context: ...Average, which you can override in the course.rb` file. For example, in our course, we p...


Near line 122: Possible spelling mistake found.
Context: ...ormalized points. The assessment called datalab is graded out of a total of 63 points ...


Near line 137: Possible spelling mistake found.
Context: ...puted by a default Ruby function called courseAverage, which can be overridden by the `cours...


Near line 137: Possible spelling mistake found.
Context: ...verage, which can be overridden by the course.rb` file in the course directory. Here is ...


Near line 151: Possible spelling mistake found.
Context: ... file" on the "Manage course" page. ## Handin History For each lab, students can vie...


Near line 153: Possible spelling mistake found.
Context: ...ciated with those submissions, via the handin history page. ## Gradesheet The _gra...


Near line 155: Possible spelling mistake found.
Context: ...ons, via the handin history page. ## Gradesheet The gradesheet (not to be confused w...


Near line 157: Possible spelling mistake found.
Context: ...din history_ page. ## Gradesheet The gradesheet (not to be confused with the _gradeboo...


Near line 157: Possible spelling mistake found.
Context: ...adesheet_ (not to be confused with the gradebook) is the workhorse grading tool. Each a...


Near line 157: Possible spelling mistake found.
Context: ...ng tool. Each assessment has a separate gradesheet with the following features: - Provi...


Near line 165: Possible spelling mistake found.
Context: ... - Provides a link to each student's handin history. ## Gradebook The gradebook...


Near line 167: Possible spelling mistake found.
Context: ...k to each student's handin history. ## Gradebook The gradebook comes in two forms. Th...


Near line 169: Possible spelling mistake found.
Context: ...t's handin history. ## Gradebook The gradebook comes in two forms. The _student grade...


Near line 169: Possible spelling mistake found.
Context: ...ebook_ comes in two forms. The student gradebook displays the grades for a particular s...


Near line 169: Possible spelling mistake found.
Context: ...and the course average. The instructor gradebook is a table that displays the grades fo...


Near line 171: Possible spelling mistake found.
Context: ...y averages and course average. For the gradebook calculations, submissions are classifie...


Near line 171: Possible spelling mistake found.
Context: ...o Grade" submission will show up in the gradebook as NG and a zero will be used when calc...


Near line 171: Possible missing comma found.
Context: ...ission will show up in the gradebook as NG and a zero will be used when calculatin...


Near line 171: Possible spelling mistake found.
Context: ...Excused" submission will show up in the gradebook as EXC and will not be used when calcul...


Near line 183: Possible spelling mistake found.
Context: ... access the File Manager via the Manage Autolab dropdown. Note: - You cannot create f...


Near line 187: Possible spelling mistake found.
Context: ...ate to Create New Course via the Manage Autolab dropdown. - You cannot rename files in...


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

app/controllers/file_manager_controller.rb Dismissed Show dismissed Hide dismissed
filename: File.basename(absolute_path),
disposition: 'attachment')
end
send_file(absolute_path,

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

app/controllers/file_manager_controller.rb Show resolved Hide resolved
app/controllers/file_manager_controller.rb Show resolved Hide resolved
app/controllers/file_manager_controller.rb Show resolved Hide resolved
@KesterTan
Copy link
Contributor Author

The errors were the same ones we had in file manager, they're appearing again cause I moved the if else loop into a elsif loop

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

docs/instructors.md Outdated Show resolved Hide resolved
docs/instructors.md Outdated Show resolved Hide resolved
Copy link
Member

@damianhxy damianhxy left a comment

Choose a reason for hiding this comment

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

Able to view extensionless files now

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

docs/instructors.md Show resolved Hide resolved
@KesterTan KesterTan added this pull request to the merge queue Apr 20, 2024
Merged via the queue into master with commit 8511d3e Apr 20, 2024
4 of 5 checks passed
@KesterTan KesterTan deleted the file_manager_fix branch April 20, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants