slack-notifier 1.1.0 → 1.2.0

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: 31725a6d5391e72e7d0b4c40733209b2f07cca3a
4
- data.tar.gz: 52ac6b2e70a4bc138a5957b0131136109bae87bd
3
+ metadata.gz: 381988fd2d67aa541bc06565270991713da8f7d0
4
+ data.tar.gz: 36d7e7196a763ef4b07eb698f0f072eccba597ef
5
5
  SHA512:
6
- metadata.gz: 75075f1cb873ce237063f7f68425d9745a85b007744fa78741c0a04954de6d5b0d7647480bde366d739fedc48175aaa677841a001eea5fe2d83f501e8be91343
7
- data.tar.gz: c0546c41a9eec3ccd44bf8537ca415ea2183a30f4859cde34d40b3d0e71baf6a9732cf68056a72cba06de4bd95dfd9d92ba7da3f8d42aa79c27553dc2f2bebd8
6
+ metadata.gz: 2109923737e8d0f772b2aa54100b363c79f8d1d51d016bb2207634de817cbbc2e4673d7a944f486712a9f46667bddd6059a975e46781c98d6504449f61d9ed82
7
+ data.tar.gz: 358d437fa6484dd9ff544a12fd84d87534038a348b989bacce57ac8a6b085c363304029e473467517150e06ad682759bb9fb1b7ab90b42383f30729434056df2
@@ -11,7 +11,7 @@ module Slack
11
11
  end
12
12
 
13
13
  def initialize string
14
- @orig = string
14
+ @orig = fix_encoding string
15
15
  end
16
16
 
17
17
  def formatted
@@ -28,6 +28,13 @@ module Slack
28
28
 
29
29
  private
30
30
 
31
+ def fix_encoding string
32
+ string.encode 'UTF-8',
33
+ 'binary',
34
+ :invalid => :replace,
35
+ :undef => :replace
36
+ end
37
+
31
38
  def slack_link link, text=nil
32
39
  out = "<#{link}"
33
40
  out << "|#{text}" if text && !text.empty?
@@ -46,4 +53,4 @@ module Slack
46
53
 
47
54
  end
48
55
  end
49
- end
56
+ end
@@ -1,5 +1,5 @@
1
1
  module Slack
2
2
  class Notifier
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -37,6 +37,17 @@ describe Slack::Notifier::LinkFormatter do
37
37
  expect( formatted ).to include("<http://example2.com|this2>")
38
38
  end
39
39
 
40
+ it "handles invalid unicode sequences" do
41
+ expect {
42
+ described_class.format("This sequence is invalid: \255")
43
+ }.not_to raise_error
44
+ end
45
+
46
+ it "replaces invalid unicode sequences with the unicode replacement character" do
47
+ formatted = described_class.format("\255")
48
+ expect(formatted).to eq "\uFFFD"
49
+ end
50
+
40
51
  end
41
52
 
42
- end
53
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Sloan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " A slim ruby wrapper for posting to slack webhooks "
14
14
  email: