openzim / python-scraperlib

Collection of Python code to re-use across Python-based scrapers
GNU General Public License v3.0
18 stars 16 forks source link

Deal with inconsistencies in magic mime detection #43

Closed satyamtg closed 3 years ago

satyamtg commented 3 years ago

This fixes #42 by adding a mime mapping to deal with inconsistencies in mimetype detection by magic due to different magic databases on different platforms. We try to search the mime that gets detected in our mapping and return the result from there, or if not found, we return the detected mime itself.

codecov[bot] commented 3 years ago

Codecov Report

Merging #43 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #43   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines          777       780    +3     
=========================================
+ Hits           777       780    +3     
Impacted Files Coverage Δ
src/zimscraperlib/filesystem.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 427f5a0...aa3618c. Read the comment docs.

rgaudin commented 3 years ago

@satyamtg can you add a test to secure so properly get the expected mimetype always?