Bug(バグ) #3212
Shinichi Urabe が11年以上前に更新
h3. 現象
# プロフィール本文や日記本文に外部のURL ( @http://example.com/?hoge=fuga&test=tetete@ ) (http://example.com/?hoge=fuga&test=tetete) のようなURLを投稿する
# 携帯端末で日記本文やプロフィール本文を開き、URLをクリックすると中継用のページが表示される
# 以下のポイントが不自然である
## 中継用のページに飛んだ時点でURLを見ると ( @/proxy?url=http%3A%2F%2Fexample.com%2F%3Fhoge%3Dfuga%26amp%3Btest%3Dtetete@ ) (/proxy?url=http%3A%2F%2Fexample.com%2F%3Fhoge%3Dfuga%26amp%3Btest%3Dtetete) のようになっている
## input フィールドの URL が ( @http://example.com/?hoge=fuga&test=tetete@ ) (http://example.com/?hoge=fuga&test=tetete) となっている
## mailto のスキームを開くと ( @http://example.com/?hoge=fuga&test=tetete@ ) メールのスキームを開くと (http://example.com/?hoge=fuga&test=tetete) となっている
## Googleの変換用のURLも ( @http://www.google.co.jp/gwt/x?u=http%3A%2F%2Fexample.com%2F%3Fhoge%3Dfuga%26amp%3Bamp%3Btest%3Dtetete@ ) (http://www.google.co.jp/gwt/x?u=http%3A%2F%2Fexample.com%2F%3Fhoge%3Dfuga%26amp%3Bamp%3Btest%3Dtetete) となっている
h3. 原因
* A: _op_auto_links_outer_urls() ヘルパーにパラメータが渡った時点でHTMLエスケープされた文字列が渡ってきている、HTMLエスケープされた文字列を urlencode() している 「処理の順番が逆」
* B: default/urlProxy アクションで HTMLエスケープされた文字列を urlencode() している「処理の順番が逆」
h3. 修正案
* urlencode() した文字列を HTMLエスケープするように順番を変える
* HTMLエスケープされた文字列は一度戻したうえで、urlencode() し、その文字列を再度 HTMLエスケープするように処理を変える
# プロフィール本文や日記本文に外部のURL ( @http://example.com/?hoge=fuga&test=tetete@ ) (http://example.com/?hoge=fuga&test=tetete) のようなURLを投稿する
# 携帯端末で日記本文やプロフィール本文を開き、URLをクリックすると中継用のページが表示される
# 以下のポイントが不自然である
## 中継用のページに飛んだ時点でURLを見ると ( @/proxy?url=http%3A%2F%2Fexample.com%2F%3Fhoge%3Dfuga%26amp%3Btest%3Dtetete@ ) (/proxy?url=http%3A%2F%2Fexample.com%2F%3Fhoge%3Dfuga%26amp%3Btest%3Dtetete) のようになっている
## input フィールドの URL が ( @http://example.com/?hoge=fuga&test=tetete@ ) (http://example.com/?hoge=fuga&test=tetete) となっている
## mailto のスキームを開くと ( @http://example.com/?hoge=fuga&test=tetete@ ) メールのスキームを開くと (http://example.com/?hoge=fuga&test=tetete) となっている
## Googleの変換用のURLも ( @http://www.google.co.jp/gwt/x?u=http%3A%2F%2Fexample.com%2F%3Fhoge%3Dfuga%26amp%3Bamp%3Btest%3Dtetete@ ) (http://www.google.co.jp/gwt/x?u=http%3A%2F%2Fexample.com%2F%3Fhoge%3Dfuga%26amp%3Bamp%3Btest%3Dtetete) となっている
h3. 原因
* A: _op_auto_links_outer_urls() ヘルパーにパラメータが渡った時点でHTMLエスケープされた文字列が渡ってきている、HTMLエスケープされた文字列を urlencode() している 「処理の順番が逆」
* B: default/urlProxy アクションで HTMLエスケープされた文字列を urlencode() している「処理の順番が逆」
h3. 修正案
* urlencode() した文字列を HTMLエスケープするように順番を変える
* HTMLエスケープされた文字列は一度戻したうえで、urlencode() し、その文字列を再度 HTMLエスケープするように処理を変える