JuliaAstro / FITSIO.jl

Flexible Image Transport System (FITS) file support for Julia
http://juliaastro.org/FITSIO.jl/
MIT License
55 stars 29 forks source link

conditionally disable the extended filename parser #174

Closed jishnub closed 2 years ago

jishnub commented 2 years ago

This depends on https://github.com/JuliaAstro/CFITSIO.jl/pull/9, so tests will pass after that is merged and a version tagged.

After this, it's possible to conditionally disable the extended filename syntax through a keyword argument. This adds support for filenames with square brackets in them (originally raised as an issue in https://github.com/JuliaAstro/FITSIO.jl/issues/157). With the extended parser disabled, the filename string is not tokenized and is treated literally as the name of the file on disk.

On master

julia> FITS(tempname()*"[1].fits", "w") do f
           write(f, [1,2])
           read(f[1])
       end
ERROR: CFITSIO has encountered an error while processing /tmp/jl_gNF8za[1].fits. Error code 125: parse error in input file URL

After this PR

julia> FITS(tempname()*"[1].fits", "w", extendedparser = false) do f
           write(f, [1,2])
           read(f[1])
       end
2-element Vector{Int64}:
 1
 2
jishnub commented 2 years ago

CI failure is because of the pkg server sync issue, as it's not being able to find the latest version of cfitsio

codecov[bot] commented 2 years ago

Codecov Report

Merging #174 (9523d88) into master (95780ef) will increase coverage by 0.09%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #174      +/-   ##
==========================================
+ Coverage   91.35%   91.45%   +0.09%     
==========================================
  Files           5        5              
  Lines         613      620       +7     
==========================================
+ Hits          560      567       +7     
  Misses         53       53              
Impacted Files Coverage Δ
src/FITSIO.jl 100.00% <100.00%> (ø)
src/image.jl 95.55% <100.00%> (-0.04%) :arrow_down:
src/header.jl 85.88% <0.00%> (ø)
src/fits.jl 95.83% <0.00%> (+0.31%) :arrow_up:

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 95780ef...9523d88. Read the comment docs.