Skip to content

[Bug]: HTML preview fails to display local images in Electron mode #4243

Description

@sgalcheung

Module

WebUI & Remote Access

Platform

macOS (Intel)

AionUi Version

2.2.2

Bug Description

Bug Description

在本地 Electron 环境下,通过 AionUi 的 HTML 预览功能查看包含本地图片的 HTML 文件时,图片无法正常显示。

Screenshots / Screen Recordings

Image

Environment

  • AionUi Version: [2.2.2]
  • OS: [macOS]
  • Architecture: [x64]
  • Mode: Electron (Desktop)

Steps to Reproduce

Steps to Reproduce

  1. 在本地工作区(Workspace)中创建一个简单的 HTML 文件,例如 test.html
  2. 在 HTML 中使用相对路径引用一张位于同一目录下的图片,例如 <img src="./test-image.png" alt="test">
  3. 确保 test-image.png 确实存在于与 test.html 相同的目录中。
  4. 在 AionUi 的 Electron 桌面端中打开并预览该 test.html 文件。
  5. 观察预览窗口中图片是否显示。

Expected Behavior

Expected Behavior

HTML 文件中的本地图片应能正常加载并显示在预览窗口中。

Actual Behavior

Actual Behavior

图片无法显示,预览窗口中仅显示图片的替代文本(如 alt 属性中的内容)或空白区域。

Additional Context

Additional Context

  • 已验证图片文件确实存在于 HTML 中指定的相对路径位置。
  • 尝试使用绝对路径(file:///...)引用图片,问题依旧。
  • 在浏览器中直接打开该 HTML 文件,图片可以正常显示,排除 HTML 代码本身的问题。
  • 怀疑是 Electron 预览环境的路径解析或内容安全策略(CSP)限制导致。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/webuiWebUI remote accessbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions