Skip to content
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

fix has_quote detection to handle free-form string values in header cards #421

Merged
merged 9 commits into from
Feb 20, 2025
13 changes: 11 additions & 2 deletions fitsio/fitsio_pywrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -4444,8 +4444,17 @@ PyFITSObject_read_header(struct PyFITSObject* self, PyObject* args) {
is_string_value=0;
}
} else {
int j;
has_equals = (card[8] == '=') ? 1 : 0;
has_quote = (card[10] == '\'') ? 1 : 0;
has_quote = 0;
// Look for 0 or more space characters followed by a quote character.
for (j=10; j<FLEN_CARD; j++) {
if (card[j] == '\'') {
has_quote = 1;
break;
} else if (card[j] != ' ')
break;
}
if (has_equals && has_quote) {
is_string_value=1;
} else {
Expand Down Expand Up @@ -4511,7 +4520,7 @@ PyFITSObject_read_header(struct PyFITSObject* self, PyObject* args) {

} else {

// if its a stringwe just store it.
// if it's a string we just store it.
if (is_string_value) {
convert_to_ascii(longstr);
add_string_to_dict(dict,"value",longstr);
Expand Down
Loading