Project

General

Profile

Actions

Backport(バックポート) #2829

closed

小窓になりうるドメインを入力すると正しくないURLでリンクが生成される

Added by Yuma Sakata almost 13 years ago. Updated almost 13 years ago.

Status:
Fixed(完了)
Priority:
Normal(通常)
Assignee:
Target version:
Start date:
2012-01-31
Due date:
% Done:

100%

Estimated time:

Description

概要

www.google.co.jpwww.amazon.co.jp など,小窓となりうるリンクが存在する場合に http://www.www.google.co.jphttp://www.www.amazon.co.jp などといったようなリンクが生成される.

!https://redmine.openpne.jp/attachments/397/スクリーンショット.png!

参考: https://redmine.openpne.jp/issues/2323#note-3

確認環境

OpenPNE 3.7.0-dev
OpenPNE 3.6.1
OpenPNE 3.4.19


Related issues 1 (0 open1 closed)

Related to OpenPNE 3 - Bug(バグ) #2770: 小窓になりうるドメインを入力すると正しくないURLでリンクが生成されるFixed(完了)Yuya Watanabe2012-01-31

Actions
Actions #1

Updated by Yuya Watanabe almost 13 years ago

  • Status changed from New(新規) to Accepted(着手)
  • Assignee set to Yuya Watanabe
Actions #2

Updated by Yuya Watanabe almost 13 years ago

原因

下記部分で $url にすでに www が付与されている状態であるにもかかわらず www が更に付与される状態となっている.

lib/helper/opUtilHelper.php 347行目

 334 function op_url_cmd($text)
 335 {
 336   return preg_replace_callback(SF_AUTO_LINK_RE, '_op_url_cmd', $text);
 337 }
 338 
 339 function _op_url_cmd($matches)
 340 {
 341   $url = $matches[2].$matches[3];
 342   $cmd = '';
 343 
 344   if ($matches[2] == 'www.')
 345   {
 346     $cmd .= 'www.';
 347     $url = 'http://www.'.$url;
 348   }

修正内容

347 行目で www が付与される意味はないはずなので,ここで www を付与しないように修正する.

diff --git a/lib/helper/opUtilHelper.php b/lib/helper/opUtilHelper.php
index d918493..5a17e99 100644
--- a/lib/helper/opUtilHelper.php
+++ b/lib/helper/opUtilHelper.php
@@ -344,7 +344,7 @@ function _op_url_cmd($matches)
   if ($matches[2] == 'www.')
   {
     $cmd .= 'www.';
-    $url = 'http://www.'.$url;
+    $url = 'http://'.$url;
   }

   if (preg_match('/([a-zA-Z0-9\-.]+)\/?(?:[a-zA-Z0-9_\-\/.,:;\~\?@&=+$%#!()])*/', $matches[3], $pmatch))
Actions #3

Updated by Yuya Watanabe almost 13 years ago

  • Status changed from Accepted(着手) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

更新履歴 ca61f40a3bf858664d7739ac1ecb95f13900cf3b で適用されました。

Actions #4

Updated by Kousuke Ebihara almost 13 years ago

  • Status changed from Pending Review(レビュー待ち) to Pending Testing(テスト待ち)
  • % Done changed from 50 to 70
Actions #5

Updated by Yuma Sakata almost 13 years ago

  • Status changed from Pending Testing(テスト待ち) to Fixed(完了)
  • % Done changed from 70 to 100

テストOKです。

Actions

Also available in: Atom PDF