phiresky / ripgrep-all

rga: ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc.
Other
6.4k stars 148 forks source link

Tree magic misidentifies mimetype as application/octet-stream #214

Open xiaoniu-578fa6bff964d005 opened 4 months ago

xiaoniu-578fa6bff964d005 commented 4 months ago

Describe the bug

rga --rga-adapters=zip --rga-accurate doesn't work for zip file on macOS.

To Reproduce

Attach example file: new.zip

Run command: RUST_LOG=debug rga --rga-adapters=zip --rga-accurate --rga-no-cache -l 2018 Output

rg: new.zip: preprocessor command failed: '"/opt/homebrew/bin/rga-preproc" "new.zip"':
-------------------------------------------------------------------------------
[2024-03-06T16:00:29Z DEBUG ripgrep_all::config] Config: {"$schema":"./config.v1.schema.json","accurate":true,"adapters":["zip"],"cache":{"disabled":true},"custom_adapters":[]}
[2024-03-06T16:00:29Z DEBUG ripgrep_all::preproc] path (hint) to preprocess: ".../test/new.zip"
[2024-03-06T16:00:29Z DEBUG ripgrep_all::adapters] Chosen available adapters: zip
[2024-03-06T16:00:29Z DEBUG ripgrep_all::preproc] Archive recursion depth: 0
[2024-03-06T16:00:29Z DEBUG ripgrep_all::preproc] mimetype: "application/octet-stream"
[2024-03-06T16:00:29Z DEBUG ripgrep_all::preproc] Chose adapter 'postprocprefix' because of matcher Fast(FileExtension("default"))
.../test/new.zip adapter: postprocprefix
Error: during preprocessing

Caused by:
    0: run_adapter(.../test/new.zip)
    1: No cache?

Screenshots If applicable, add screenshots to help explain your problem.

Operating System and Version macOS 14.2.1

Output of rga --version ripgrep-all 0.10.6

Other related bug: aahancoc/tree_magic/issues/6 I find that mimetype is correct on Linux.