JavaScript 嵌入在导入图像路径时未添加目录斜杠,导致图像损坏

This looks like… a simple bug?

Note the slash missing in “catmedia”.

I didn’t find a report for this bug, although this one might be related: Embedded topics don't handle "//"-images properly

Can anyone reproduce? Or is there a fix that we could implement on our side? (other than defining images with absolute URLs, which we could do moving forward but what about the articles already published)

嗯,虽然隔了一段时间,但可以复现。

上述代码似乎会规范化以 / 开头的图片 URL(修正主机名),但不会处理相对于当前 URL 的相对路径。

也许应该改成这样?

    if src.present? && !src.start_with?('http')

如果我没猜错,上面几行代码也存在同样的问题。

2 个赞