-
Notifications
You must be signed in to change notification settings - Fork 76
Add mimetype detection to walkfs #1521
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1521 +/- ##
==========================================
- Coverage 80.80% 80.54% -0.26%
==========================================
Files 396 396
Lines 34826 34836 +10
==========================================
- Hits 28141 28060 -81
- Misses 6685 6776 +91
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merging this PR will degrade performance by 82.42%
Performance Changes
Comparing |
|
I'm surprised this doesn't alter the benchmark. Can you say anything if it has a noticeable performance impact? |
The benchmark unfortunately only calls
Seems to be slightly slower in the test below on a ext4 filesystem with a default install of Ubuntu server (~100k files, ~4GB vmdk): |
|
Maybe we can make the MIME type generation optional? That way, we can switch it on or off as needed. |
Maybe change it to use
I was thinking this too. Maybe use |
| is_suid (boolean): denotes if the entry has the set-user-id bit set. | ||
| attr (string[]): list of key-value pair attributes separated by '='. | ||
| fs_types (string[]): list of filesystem type(s) of the entry. | ||
| mimetype (string): detected mimetype of the entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this record docstring is still a bit useless at this point, but would you mind moving it up to the right spot?
| @arg("--walkfs-path", default="/", help="path to recursively walk") | ||
| @arg("--capability", action="store_true", help="output capability records") | ||
| def walkfs(self, walkfs_path: str = "/", capability: bool = False) -> Iterator[FilesystemRecord]: | ||
| @arg("--no-mimetype", action="store_true", help="disable mimetype lookup of files") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards flipping this and making it --mimetype to enable mimetype lookup. Sounds like a safer default?
As promised in #1387, this PR adds mimetype detection to the walkfs plugin.