cdgriffith / puremagic

Pure python implementation of identifying files based off their magic numbers
MIT License
168 stars 33 forks source link

FITS file detection no longer working #100

Closed ejeschke closed 1 month ago

ejeschke commented 1 month ago

In version 1.23 (at least) detection of FITS files worked correctly. But it no longer does in version 1.27:

$ ipython
Python 3.11.7 (main, Dec 15 2023, 18:12:31) [GCC 11.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.20.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import puremagic

In [2]: puremagic.from_file("/home/eric/testdata/HSC/HSCA08092010.fits", mime=True)
Out[2]: 'image/fits'

In [3]: puremagic.__version__
Out[3]: '1.23'

VS

$ ipython
Python 3.11.5 (main, Sep 11 2023, 13:23:44) [GCC 11.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.15.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import puremagic

In [2]: puremagic.from_file("/home/eric/testdata/HSC/HSCA08092010.fits", mime=True)
Out[2]: ''

In [3]: puremagic.__version__
Out[3]: '1.27'
ejeschke commented 1 month ago

Here is a small FITS file you can test with gc_msx_e.fits.zip

Unzip it first

cdgriffith commented 1 month ago

Thank you for pointing out this issue and adding example file! Fixed in 1.28

ejeschke commented 1 month ago

Thanks for the quick fix!