Skip to content

check for invalid header entity #14

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

Merged
merged 3 commits into from
May 5, 2025

Conversation

Ghesselink
Copy link
Contributor

Header entity can only be FILE_DESCRIPTION, FILE_NAME or FILE_SCHEMA. Encountered a file with FILE_INFO, which doesn't give a fail somewhere else.
e.g. ifcopenshell.validate

 python3 -m ifcopenshell.validate fail_invalid_header_entity.ifc
Validating /home/geert/Documents/gherkin/packages/simple_spf/fork/step-file-parser/fixtures/fail_invalid_header_entity.ifc
No validation issues found.

After these changes

python3 -m ifcopenshell.simple_spf /home/geert/Documents/gherkin/packages/simple_spf/fork/step-file-parser/fixtures/fail_invalid_header_entity.ifc
On line 6 column 1:
Unexpected __anon_3 ('FILE_INFO')
Expecting ENDSEC
00006 | FILE_INFO(
        ^

For the validation service, this will cause the file to fail before reaching the header validation.

@aothms
Copy link
Member

aothms commented May 5, 2025

We do have something in ifcopenshell, but indeed if there is a header entity following the three specified ones it doesn't raise an error. Also, this is probably a better place to do that check. https://github.com/IfcOpenShell/IfcOpenShell/blob/d401e4c948482c02d789a890f897b6929928f504/src/ifcparse/IfcSpfHeader.cpp#L94-L110

@aothms aothms merged commit 63a2b91 into IfcOpenShell:master May 5, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants