mail_auto_link_obfuscation 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5f3bee94220bd89058f7d7d87d4f788a08d5e6d
4
- data.tar.gz: 5752d9c9d1ac194e1f444fd5aeac4fd773b474dc
3
+ metadata.gz: 947109ff0c3285f1823f922d65078a11c56c16c2
4
+ data.tar.gz: 1f874335326fbb669fd4893c573b42a8c91c47c8
5
5
  SHA512:
6
- metadata.gz: 3a6bb4b166403f21145a2b55d8490d45be38fa5f686efc73cb92a542aab56700c4299d9ee4d1d8e4daf64b6f5806d574cff85089490cc9eb615c343c6bfc1c06
7
- data.tar.gz: d7aeb2e4d48caf00b4072c58c94edd72f32ed275d9cd84aeb74a7811bf332692100944365da4e26dba68e8d6aa4806e5b6c184d4626c7c37854a44be6ff3eb24
6
+ metadata.gz: f8f9b45d76bd7cf36bb655d314bb95ab99eb83457320e8652e4fd5565bf3235aa69a85009e0a9e5d47d2000a622e94ac692e13ed4dca72ace2495766592e655e
7
+ data.tar.gz: c0992cd6d573e072ce27455a324810f7fd91090fe17fc39dbfd7b0b344cba7375c9ea5bcf9ffac28c656076e04889e94f77829c32a4674964bdc5082d51303f3
@@ -4,9 +4,9 @@ require 'nokogiri'
4
4
  module MailAutoLinkObfuscation
5
5
  class AutoLinkObfuscator
6
6
  AUTO_LINKED_EMAIL_PATTERN = /\S+@\w+(?:\.\w+)+/
7
- AUTO_LINKED_URL_PATTERN = %r{(\w+://\w+(\.\w+)*|\w+(\.\w+)*\.\w{2,})\S*}
7
+ AUTO_LINKED_URL_PATTERN = %r{((\w+:)?//\w+(\.\w+)*|\w+(\.\w+)*\.\w{2,})\S*}
8
8
  AUTO_LINKED_PATTERN = Regexp.new([AUTO_LINKED_EMAIL_PATTERN, AUTO_LINKED_URL_PATTERN].join('|'))
9
- KEY_CHARS = /[@.:]/
9
+ KEY_CHARS = %r{[@.:/]+}
10
10
 
11
11
  def initialize(mail, options)
12
12
  @mail = mail
@@ -53,7 +53,8 @@ module MailAutoLinkObfuscation
53
53
 
54
54
  def transform_html(doc)
55
55
  doc.xpath('//body/descendant::text()').each do |node|
56
- content = transform_auto_linked_pattern(node.content) do |match|
56
+ content = CGI.escapeHTML(node.content)
57
+ content = transform_auto_linked_pattern(content) do |match|
57
58
  match.gsub(KEY_CHARS, span_template)
58
59
  end
59
60
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module MailAutoLinkObfuscation
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_auto_link_obfuscation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Jundt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2016-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties