-
-
Notifications
You must be signed in to change notification settings - Fork 591
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
detect gzipped-FITS files by magic-bytes #6693
Conversation
Hi @exitflynn, thanks for the PR. If you could add a unit test for this in https://github.com/sunpy/sunpy/blob/main/sunpy/io/tests/test_filetools.py There should be some gzipped files to use in https://github.com/sunpy/sunpy/tree/main/sunpy/data/test |
Co-authored-by: Conor MacBride <[email protected]>
Co-authored-by: Conor MacBride <[email protected]>
sure. i'll be getting to including PKZIP and BZIP2 detection and the tests tomorrow! (it's quite late here) |
No problem. I also wouldn't add the other two file formats for now. |
Hi, I just noticed that a test for detecting gzipped FITS files already exists, since i only re-modified how this was implemented. |
also i'm not sure why the CI tests have failed, is it something unrelated to my changes that I can ignore? I tried runing the tests before pushing by running |
Could you add a test where the filextension doesn't match but we still detect it properly? This means we test this new behaviour and we make sure that we don't regress in the future? |
It's not your fault, if you can rebase or merge in main then it should be fixed now #6694 |
right now there are two tests for gzipped-fits files, the I think it'd make more sense to have only one test for gzip-fits files, the latter one since if it passes then there's no need to test for the first one. Should I remove the first test (renaming the second one to |
If you can combine the two tests, I would prefer that. |
in that case, is combining them like that alright? |
Looks fine to me. |
If you could add a bugfix changelog following https://github.com/sunpy/sunpy/blob/main/changelog/README.rst and if you could also deal with the pre-commit.ci fail. |
yep, done! (I mean I think that should do it? I can't figure out what's causing the |
Co-authored-by: Conor MacBride <[email protected]>
Co-authored-by: Conor MacBride <[email protected]>
thanks @ConorMacBride! done 👍 |
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.
Thanks @exitflynn!
🤠 Thanks Conor, Nabil and Stuart for your time! |
PR Description
Detection for gzipped-FITS files is now done by checking file signatures instead of checking for file extensions.
First a gzip file-signature is checked and if found, the file's first few bytes are decompressed and checked for the FITS file signature.
The PR closes #6692.