Bug 475765 - FITS viewer truncates header strings (values & comments) at `/` characters
Summary: FITS viewer truncates header strings (values & comments) at `/` characters
Status: REPORTED
Alias: None
Product: kstars
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Jasem Mutlaq
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-17 19:55 UTC by cgobat
Modified: 2023-10-17 19:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Minimal example of FITS header with slash(es) (2.81 KB, image/fits)
2023-10-17 19:55 UTC, cgobat
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cgobat 2023-10-17 19:55:59 UTC
Created attachment 162385 [details]
Minimal example of FITS header with slash(es)

SUMMARY
When a slash (`/`) character is present in a FITS header value or comment string, the string is truncated/split at that character.

STEPS TO REPRODUCE
1. Use KStars FITS viewer to open a FITS file that contains slashes in one or more header comments or value strings (see attachment for example)
2. Open header (i.e. `Ctrl-H`)
3. Note that the comments/values of interest are cut off where the slash should have been

OBSERVED RESULT
See the screenshot in this GitHub comment:
https://github.com/scriptorron/indi_pylibcamera/pull/49#issuecomment-1766943549

EXPECTED RESULT
I would expect the full comment field (up to the max 80-character-per-card limit, that is) to be displayed.

SOFTWARE/OS VERSIONS
I am personally able to reproduce this using KStars 3.4.1 on Ubuntu 20.04, 3.6.2 on Linux Mint Debian Edition 6, and 3.6.7 on Windows 10. I do not think this is an OS-specific thing.

ADDITIONAL INFORMATION
I suspect this is due to a parsing routine that is naïvely splitting the string on instances of the slash character without taking into account the presence of quotation marks (in the case of value strings) or the fact that only one slash (the first occurrence outside a value string) should be used to delimit the comment.

For reference, the header of the attached example is shown below:
SIMPLE  =                    T / conforms to FITS standard
BITPIX  =                    8 / array data type
NAXIS   =                    0 / number of array dimensions
EXTEND  =                    T
SLASHVAL= 'string w/ a slash'  / no slash here
SLASHCOM= 'no slash here'      / comment w/ a slash