Closed coder6583 closed 2 months ago
lib/archive.rb (5)
`74-74`: Ensure `File.cleanpath` usage correctly handles edge cases in path normalization. Please verify that `File.cleanpath` with `rel_root = true` correctly handles all edge cases, especially with paths containing multiple relative components like `././../`. --- `48-48`: Refactor to improve clarity and maintainability of nested file hierarchy recovery. Consider refactoring the `recoverHierarchy` method to improve clarity. The nested loop and conditional logic can be simplified or broken down into smaller methods to enhance readability and maintainability. --- Line range hint `15-15`: Review the handling of special macOS files in `get_files`. Ensure that the handling of special macOS files like `__MACOSX`, `.DS_Store`, and `.metadata` is consistent and correctly filters out these files from processing where necessary. --- Line range hint `15-15`: Check directory detection logic in `get_files`. Verify that the `looks_like_directory?` method accurately identifies directories, especially in edge cases where non-directory paths might end with a slash due to formatting or errors. --- Line range hint `15-15`: Ensure correct handling of file indices in `get_nth_file`. Confirm that the method `get_nth_file` correctly handles file indices, especially in cases where special files are skipped, which might affect the index count.
Description
Motivation and Context
The filenames in tar files made using![image](https://github.com/autolab/Autolab/assets/38949473/6c8b45ec-ff1b-4fb1-a342-3570316a3d7f)
..
are weird, like tartraversal2.tar.zip made withtar -cf tartraversal2.tar ../../Desktop/MossTest/autograde-Makefile ../../Desktop/MossTest/dave.c ../../Desktop/MossTest/hello.c
. See screenshot below:See issue #2111.
How Has This Been Tested?
After:![image](https://github.com/autolab/Autolab/assets/38949473/3194d561-8517-45a2-b0a9-a0da7c444a9b)
Types of changes
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for lintingOther issues / help required
Do you think this is enough, or should I try to hide the metadata in the tar files?