diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-01-23 02:12:45 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-01-23 02:12:45 +0900 |
commit | 63f421597308eb2da24dd839f644fafe1aa21148 (patch) | |
tree | 3adcb48a51a10afb901e8841aea9f30f09e8e9d7 | |
parent | 5858303e83bc987992ce6e8a11db22116287e8aa (diff) | |
download | aclog-63f421597308eb2da24dd839f644fafe1aa21148.tar.gz |
frontend: open source in new tab
-rw-r--r-- | frontend/src/components/tweet.vue | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/frontend/src/components/tweet.vue b/frontend/src/components/tweet.vue index 03d15cf..9d82517 100644 --- a/frontend/src/components/tweet.vue +++ b/frontend/src/components/tweet.vue @@ -113,8 +113,10 @@ export default { }, formattedSource() { const str = this.tweet.source; - if (/^<a href="([^"]+?)" rel="nofollow">([^<>]+?)<\/a>$/.test(str)) { - return str.replace(/&/g, "&"); + const re = /^<a href="([^"]*)" rel="nofollow">([^<>]*)<\/a>$/; + const match = str.match(re); + if (match !== null) { + return '<a href="' + Utils.escapeHTML(match[1]) + '" rel="nofollow" target="_blank">' + Utils.escapeHTML(match[2]) + '</a>'; } else { return Utils.escapeHTML(str); } |