Skip to content

Comments

mimetype 엔트리 저장 순서/압축 규칙 정리 및 검증 테스트 추가#21

Merged
airmang merged 1 commit intomainfrom
codex/update-zip-compression-type-handling
Feb 18, 2026
Merged

mimetype 엔트리 저장 순서/압축 규칙 정리 및 검증 테스트 추가#21
airmang merged 1 commit intomainfrom
codex/update-zip-compression-type-handling

Conversation

@airmang
Copy link
Owner

@airmang airmang commented Feb 18, 2026

Motivation

  • HWPX 패키지를 저장할 때 mimetype 엔트리는 항상 압축하지 않고 먼저 기록해야 하는 규칙을 명확히 반영하기 위해 변경했습니다.
  • ZIP 엔트리 생성 로직을 재사용 가능하게 정리하여 코드 중복을 줄이고 유지보수를 쉽게 하려는 목적입니다.
  • 저장 결과의 compress_type이 기대값대로 설정되는지 자동으로 검증할 필요가 있었습니다.

Description

  • HwpxPackage._save_to_zip의 직접 쓰기 로직을 _write_archive로 분리하여 mimetype를 먼저 기록하도록 변경했습니다.
  • ZIP 엔트리 생성/기록 로직을 _write_zip_entry 헬퍼로 공통화했고, _write_mimetype는 이 헬퍼를 사용해 mimetypeZIP_STORED로 기록하도록 했습니다.
  • 나머지 파트는 정렬된 순서로 순회하여 _write_zip_entry(..., ZIP_DEFLATED)로 기록하도록 유지했습니다.
  • tests/test_opc_package.py에 저장된 ZIP 엔트리의 compress_type을 검사하는 test_save_preserves_expected_compress_type_per_entry 테스트를 추가했습니다.

Testing

  • pytest -q tests/test_opc_package.py를 실행해 변경된 테스트를 포함한 스위트를 실행했습니다.
  • 결과: 3 passed, 1 warning으로 모든 테스트가 통과했습니다.

Codex Task

@airmang airmang merged commit 9265a2c into main Feb 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant