Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

adapter.aasx: Missing supplementary file aborts reading with failsafe

未关闭 适合新手
#665 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend, databases

调研方向

从链接行中的 sdk/basyx/aas/adapter/aasx.py 的 _add_supplementary_file() 和 open_part() 调用开始。检查现有读取路径如何处理缺失的包部件,以及如何测试 failsafe 模式。完成标准是:使用 failsafe=True 时,缺失的补充部件会被记录日志并跳过;使用 failsafe=False 时,会引发明确的错误。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Python
星标
106
派生
59
平均合并
4 天 1 小时
30 天内合并 PR
3

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

eclipse-basyx/basyx-python-sdk 的其他 Issue

查看 eclipse-basyx/basyx-python-sdk 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。