-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
Improve comment about magic word not present. #318
Improve comment about magic word not present. #318
Conversation
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.
After reading this comment, this is on purpose?
read.go
Outdated
@@ -160,7 +163,7 @@ func (r *reader) readHeader() ([]*Element, error) { | |||
return nil, err | |||
} | |||
if string(data[128:]) != magicWord { | |||
return nil, nil | |||
return nil, ErrorMagicWord |
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.
I think the reason for this was the note at L157: namely, if the magic word isn't found we try to parse the Dataset without the preamble: #59. This was reported by folks who had files like this in production! Perhaps we should make the user pass an explicit parse option to trigger this behavior if we think there's harm in doing this as a default.
Of course, parsing without metadata can cause all sorts of problems which may eventually result in an error anyway.
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.
@wkoszek do y'all recall if this fix actually lead to y'all successfully parsing DICOMs without the header?
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.
That makes sense. I reverted the commit, but I updated the comment because it's rather unusual to see a function returning nil, nil
like that and the comment was a bit hidden up top. Will update PR title
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.
Agreed, thanks for the update!
Yep, I think it was indeed intentional: #59 |
This reverts commit 9e8e2f3.
Just fixing a little bug I stumbled upon while navigating the codebase.Improving comments only.