zhanghai / zhanghai/MaterialFiles

Use file header instead of file extension for file type recognition

Open
#960 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
9k
Forks
736
PR merge metrics
No merged PRs in 30d

Description

On Unix systems it is common to decide on the file type based on the something called magic bytes in contrast to using solely the file extension. Nautilus for example does adhere to this convention. Would it be possible for Material files to do the same? How much would the performance cost for this change?

I noticed this bug while scrolling through cached data which didn't have any file extension or some generic .0. As soon as I renamed the file to .webp the file manager correctly showed the image preview and also suggested the right application to open with.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named. Start by locating MaterialFiles' file-type recognition path and assessing cached files without extensions; define acceptable magic-byte coverage and performance before implementing, then verify previews and application suggestions for extensionless files.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.