Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

adapter.aasx: Missing supplementary file aborts reading with failsafe

Đang mở Phù hợp với người mới
#665 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend, databases

Hướng nghiên cứu

Bắt đầu với _add_supplementary_file() và lời gọi open_part() trong sdk/basyx/aas/adapter/aasx.py tại các dòng được liên kết. Kiểm tra cách các luồng đọc hiện có xử lý những phần bị thiếu trong gói và cách chế độ failsafe được kiểm thử. Công việc hoàn tất khi phần bổ sung bị thiếu được ghi log và bỏ qua với failsafe=True, còn failsafe=False gây ra lỗi rõ ràng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug good-first-issue sdk

AASXReader.read_into() raises KeyError when a File element
or the default thumbnail points to a part that is not in the package,
even with failsafe=True:

https://github.com/eclipse-basyx/basyx-python-sdk/blob/2773ac069d3163cbbd32c3c634813d38bbe521ad/sdk/basyx/aas/adapter/aasx.py#L396-L405

The object is already in the object_store at that point, so the
read stops half-way.

Steps to reproduce:

sm = model.Submodel("urn:sm:1", submodel_element=[
    model.File("f", "application/pdf", "/aasx/missing.pdf")])
# the writer only logs a warning and writes the package
with aasx.AASXWriter("x.aasx", failsafe=True) as w:
    w.write_all_aas_objects(
        "/aasx/data.json", model.DictIdentifiableStore([sm]),
        aasx.DictSupplementaryFileContainer())
with aasx.AASXReader("x.aasx", failsafe=True) as r:
    r.read_into(model.DictIdentifiableStore(),
                aasx.DictSupplementaryFileContainer())
# KeyError: 'Could not find part /aasx/missing.pdf in package'

The repository server calls load_directory() at import, so one such
file in INPUT stops the container from starting.

Expected behavior: With failsafe=True, the missing part is
logged and skipped, like other defects. With failsafe=False, a clear
error is raised.

Actual behavior: KeyError in both modes; the objects read so far
stay in the store.

Environment: develop @ 2773ac06.

Possible fix: Catch KeyError around open_part() in
_add_supplementary_file(): log and return None if failsafe,
otherwise re-raise. Our own writer produces such packages in failsafe
mode (see #228), so the reader should accept them.

Ngôn ngữ chính
Python
Star
105
Fork
56
Merge trung bình
4 ngày 1 giờ
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của eclipse-basyx/basyx-python-sdk

Tất cả issue của eclipse-basyx/basyx-python-sdk

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.