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 に対する相対パスの URL は正規化していないようです。

もしかしたら、以下のようにすべきではないでしょうか?

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

もし私の推測が正しいなら、数行上のコードにも同じバグがあると思います。

「いいね!」 2