Ticket #12884

lt; という文字列を含む SVG ファイルが表示できない
Open Date: 2008-06-28 20:43 Last Update: 2008-09-19 23:57

Reporter:
Owner:
Type:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
7
Severity:
5 - Medium
Resolution:
Fixed
File:
1

Details

Inkscape の配布パッケージに含まれている
blend_modes.svg が、sie.php 経由だと表示できません。
sie.js の先頭にある以下のコードが原因です。

if (ait.match(/lt;/)) {
ait = ait.replace(/<.+?>/g,''); //ソース内のタグを
除去
};
//エンティティを文字に戻す
ait = ait.replace(/.lt;/g,'<').replace
(/.gt;/g,'>').replace(/.quot;/g,'"');

つまり sie.php を使わなくても、次のように lt; という文
字列がインラインで埋め込まれている時に、上記の変換が行
われるとおかしなことになります。

<script type="image/svg+xml">
<svg xmlns="http://www.w3.org/2000/svg">
... &lt; ...
</svg>
</script>

誤動作を避けるために、

・置換は .lt; でなく &lt; という文字列に対して行う
・この処理の部分を、if (sieb_s) {...} で囲むか、sie.js
の最後に移動させるか、ブックマークレット側に追い出す

のような対策を施した方が良いと思います。

Ticket History (3/9 Histories)

2008-07-02 22:38 Updated by: dhrname
  • Owner Update from (None) to dhrname
  • Resolution Update from None to Accepted
Comment
Logged In: YES
user_id=32883

了解です。返答が遅れて申し訳ありません。
対策を立ててみます。
2008-07-07 21:38 Updated by: dhrname
Comment
Logged In: YES
user_id=32883

0.26では、この「置換は .lt; でなく &lt; という文字列に対して
行う」という処置を行いました。
2008-07-20 20:38 Updated by: dhrname
  • Resolution Update from Accepted to Fixed
2008-08-31 21:30 Updated by: revulo
  • File 3329: sie_sieb.patch is attached
Comment
Logged In: YES
user_id=33975

パッチを作ったので、添付しておきます。
その他の修正も含んでいるので、簡単な説明を書いておきます。

・var sieb_s; を追加。これでブックマークレット経由かどうかの
判定が楽にできる
・ブックマークレット経由、かつ < → &lt; のように変換された
ソースの場合のみ、元に戻す処理を実行
・ソースを貼り付けた場合 & → &amp; に変換されるはずなので、
その逆変換の処理を追加
・最後の try~catch は不要になるので削除

sieb_s という変数名は sieb という短い名前にしたいと思いまし
たが、それにはブックマークレット側の変更も必要になるので、そ
のままにしています。
2008-09-01 19:57 Updated by: dhrname
  • Priority Update from 5 - Medium to 7
  • Resolution Update from Fixed to Accepted
Comment
Logged In: YES
user_id=32883

了解です。早速パッチを当ててみます。
2008-09-01 22:07 Updated by: dhrname
  • Priority Update from 7 to 8
Comment
Logged In: YES
user_id=32883

リビジョン459で適用しました。
2008-09-15 18:46 Updated by: dhrname
  • Priority Update from 8 to 7
  • Resolution Update from Accepted to Fixed
2008-09-19 23:57 Updated by: revulo
  • Status Update from Open to Closed
Comment
Logged In: YES
user_id=33975

SIE 0.31 以降では直っているはずなので、状態を完了にして
おきます。
2008-09-19 23:57 Updated by: revulo
  • Ticket Close date is changed to 2008-09-19 23:57

Attachment File List

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login