fix: reject DXF files missing EOF marker
Add regression coverage for issue #1.
This commit is contained in:
1 parent
9df1bcfc2a
commit
2e4eca5e07
2 files changed
+10
No files matched your search
@@ -51,6 +51,8 @@ def read_dxf_bytes(raw):
|
||||
current['section'] = section
|
||||
if current:
|
||||
records.append(current)
|
||||
if not records or records[-1]['type'] != 'EOF' or records[-1]['tags']:
|
||||
raise ValueError('DXF 종료 표시(EOF)가 없습니다. 파일이 끝까지 저장되었는지 확인해 주세요.')
|
||||
entities = [r for r in records if r['section'] == 'ENTITIES']
|
||||
blocks, block = {}, None
|
||||
for record in records:
|
||||
|
||||
@@ -216,6 +216,14 @@ class DrawingReconstructionTests(unittest.TestCase):
|
||||
with self.assertRaisesRegex(ValueError, '관로 단면'):
|
||||
r2c.specification_model(self.model, row)
|
||||
|
||||
def test_upload_rejects_dxf_missing_end_marker(self):
|
||||
lines = self.raw.splitlines(keepends=True)
|
||||
self.assertEqual(lines[-1].strip(), b'EOF')
|
||||
truncated = b''.join(lines[:-2])
|
||||
status, payload = self.api_request(truncated)
|
||||
self.assertEqual(status, 422)
|
||||
self.assertIn('EOF', payload['error'])
|
||||
|
||||
def test_spline_validation_and_valid_linear_interpolation(self):
|
||||
def spline(weights=('1', '1'), knots=('0', '0', '1', '1'), degree='1'):
|
||||
return {'type': 'SPLINE', 'tags': [
|
||||
|
||||
Reference in new issue
Block a user