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

[hotfix] Use correct files list for sorting annotations when viewing an archive #1616

Merged
merged 2 commits into from
Sep 28, 2022

Conversation

damianhxy
Copy link
Member

@damianhxy damianhxy commented Sep 28, 2022

Description

Use result from Archive.get_files, rather than @files, when calling get_correct_filename in view.

Hotfix for #1590

Motivation and Context

Currently, we are using @files when finding the filenames for annotations.

The problem with this is that @files is the result of Archive.get_file_hierarchy, whose length does not correspond directly to the number of files (subfiles are recursively nested). Rather its length is the number of "top level" files / directories.
Screen Shot 2022-09-28 at 17 46 10

This further results in an error when get_correct_filename calls Archive.get_nth_filename, potentially on an out of bounds index.

However, viewFeedback handles this correctly since @files is only set for Archives, and is set to the result of Archive.get_files.
Screen Shot 2022-09-28 at 17 48 20

How Has This Been Tested?

  • Create an assessment that accepts tar files
  • Upload hello.tar.zip (unzip this first)
  • Create a problem and annotate a nested file

Before
Screen Shot 2022-09-28 at 17 49 31

After
Screen Shot 2022-09-28 at 17 49 52

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have run rubocop for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting

Copy link
Contributor

@20wildmanj 20wildmanj left a comment

Choose a reason for hiding this comment

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

@damianhxy damianhxy changed the title Use correct files list for sorting annotations when viewing an archive [hotfix] Use correct files list for sorting annotations when viewing an archive Sep 28, 2022
@damianhxy damianhxy merged commit 8ba3ec4 into master Sep 28, 2022
@damianhxy damianhxy deleted the hotfix-annotations-tar-files branch September 28, 2022 22:08
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