diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf35a5de..90928eae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: source venv/bin/activate # use version of ifcopenshell with desired schema parsing # TODO: revert to pyPI when schema parsing is published in the future - wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.5-a51b2c5-linux64.zip" + wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.6-8b5b400-linux64.zip" mkdir -p venv/lib/python3.11/site-packages unzip -d venv/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index de15d043..07a26c5f 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -101,7 +101,7 @@ jobs: source venv/bin/activate # use version of ifcopenshell with desired schema parsing # TODO: revert to pyPI when schema parsing is published in the future - wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.5-a51b2c5-linux64.zip" + wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.6-8b5b400-linux64.zip" mkdir -p venv/lib/python3.11/site-packages unzip -d venv/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index f6197365..1a3a54f0 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -104,7 +104,7 @@ jobs: - name: Download and install ifcopenshell run: | - wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.5-a51b2c5-linux64.zip" + wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.6-8b5b400-linux64.zip" mkdir -p .dev/venv/lib/python3.11/site-packages unzip -o -d .dev/venv/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip rm /tmp/ifcopenshell_python.zip diff --git a/backend/Makefile b/backend/Makefile index 8f3d4aa3..a73a4453 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -14,25 +14,25 @@ venv: install: venv $(PIP) install --upgrade pip find . -name 'requirements.txt' -exec $(PIP) install -r {} \; - wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.5-a51b2c5-linux64.zip" + wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.6-8b5b400-linux64.zip" mkdir -p $(VIRTUAL_ENV)/lib/python3.11/site-packages - unzip -f -d $(VIRTUAL_ENV)/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip + unzip -o -d $(VIRTUAL_ENV)/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip rm /tmp/ifcopenshell_python.zip install-macos: venv find . -name 'requirements.txt' -exec $(PIP) install -r {} \; $(PIP) install -r requirements.txt - wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.5-1c5b825-macos64.zip" + wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.6-8b5b400-macos64.zip" mkdir -p $(VIRTUAL_ENV)/lib/python3.11/site-packages - unzip /tmp/ifcopenshell_python.zip -d $(VIRTUAL_ENV)/lib/python3.11/site-packages + unzip -o -d $(VIRTUAL_ENV)/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip rm /tmp/ifcopenshell_python.zip install-macos-m1: venv find . -name 'requirements.txt' -exec $(PIP) install -r {} \; $(PIP) install -r requirements.txt - wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.5-7bdc1b6-macosm164.zip" + wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.6-8b5b400-macosm164.zip" mkdir -p $(VIRTUAL_ENV)/lib/python3.11/site-packages - unzip /tmp/ifcopenshell_python.zip -d $(VIRTUAL_ENV)/lib/python3.11/site-packages + unzip -o -d $(VIRTUAL_ENV)/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip rm /tmp/ifcopenshell_python.zip fetch-modules: diff --git a/backend/apps/ifc_validation/checks/ifc_gherkin_rules b/backend/apps/ifc_validation/checks/ifc_gherkin_rules index 9b7ec04a..e63ab289 160000 --- a/backend/apps/ifc_validation/checks/ifc_gherkin_rules +++ b/backend/apps/ifc_validation/checks/ifc_gherkin_rules @@ -1 +1 @@ -Subproject commit 9b7ec04a6c3151198efd26a4217551e02b2b66f5 +Subproject commit e63ab2893021b8f3a2ebe2fe3ea0ddb29eb8fbb2 diff --git a/backend/apps/ifc_validation/fixtures/invalid_utf8_with_bom.ifc b/backend/apps/ifc_validation/fixtures/invalid_utf8_with_bom.ifc new file mode 100644 index 00000000..c7887d8d --- /dev/null +++ b/backend/apps/ifc_validation/fixtures/invalid_utf8_with_bom.ifc @@ -0,0 +1,10 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2022-05-04T08:08:30',(''),(''),'IfcOpenShell-0.7.0','IfcOpenShell-0.7.0',''); +FILE_SCHEMA(('IFC4')); +ENDSEC; +DATA; +#1=IFCPERSON($, $,'',$,$,$,$,$); +ENDSEC; +END-ISO-10303-21; diff --git a/backend/apps/ifc_validation/tests/tests_syntax_validation_task.py b/backend/apps/ifc_validation/tests/tests_syntax_validation_task.py index 059a9fc8..68a90b7e 100644 --- a/backend/apps/ifc_validation/tests/tests_syntax_validation_task.py +++ b/backend/apps/ifc_validation/tests/tests_syntax_validation_task.py @@ -56,6 +56,30 @@ def test_syntax_validation_task_creates_error_validation_outcome(self): self.assertEqual(outcomes.first().severity, ValidationOutcome.OutcomeSeverity.ERROR) self.assertEqual(outcomes.first().outcome_code, ValidationOutcome.ValidationOutcomeCode.SYNTAX_ERROR) self.assertTrue('On line 1 column 1' in outcomes.first().observed) + + + def test_syntax_validation_task_creates_error_for_utf8_bom(self): + SyntaxValidationTaskTestCase.set_user_context() + request = ValidationRequest.objects.create( + file_name='invalid_utf8_with_bom.ifc', + file='invalid_utf8_with_bom.ifc', + size=os.path.getsize('apps/ifc_validation/fixtures/invalid_utf8_with_bom.ifc'), + ) + request.mark_as_initiated() + + syntax_validation_subtask( + prev_result={'is_valid': True, 'reason': 'test'}, + id=request.id, + file_name=request.file_name, + ) + + outcomes = ValidationOutcome.objects.filter(validation_task__request_id=request.id) + self.assertEqual(len(outcomes), 1) + self.assertEqual(outcomes.first().severity, ValidationOutcome.OutcomeSeverity.ERROR) + self.assertEqual(outcomes.first().outcome_code, ValidationOutcome.ValidationOutcomeCode.SYNTAX_ERROR) + self.assertIn("On line 1 column 1", outcomes.first().observed) + self.assertIn("character", outcomes.first().observed.lower()) + def test_determine_aggregate_status_for_multiple_outcomes(self): diff --git a/docker/backend/Dockerfile b/docker/backend/Dockerfile index 70614997..d56f2062 100644 --- a/docker/backend/Dockerfile +++ b/docker/backend/Dockerfile @@ -37,7 +37,7 @@ RUN --mount=type=cache,target=/root/.cache \ find /app/backend -name 'requirements.txt' -exec pip install --no-cache-dir -r {} \; && \ # use version of ifcopenshell with desired schema parsing # TODO: revert to pyPI when schema parsing is published in the future - wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.5-a51b2c5-linux64.zip" && \ + wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.6-8b5b400-linux64.zip" && \ mkdir -p /opt/venv/lib/python3.11/site-packages && \ unzip -d /opt/venv/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip && \ # some cleanup