gitlab-grit 2.6.6 → 2.6.7

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: 93e755061312f6d086b8189ea09986eba8f6d7f7
4
- data.tar.gz: 26694a810ea758fd7290fc7404480a01e79ec8f4
3
+ metadata.gz: 3fd54799935ea1d520a6aaa11a63a48cdddedc58
4
+ data.tar.gz: 1b998b5f0d09a223808563ebcabcd93f2a25b8c7
5
5
  SHA512:
6
- metadata.gz: 3581bae92ece861513f96844c466958e9addbeb76875d15a8ecc21b7e1d31d17a70172a0996eadce9648c62fc9c0b9c804e45b6f0865281d2a524334d8a161f3
7
- data.tar.gz: d845087cf2ee106636d5055777f412ae39d71098b8319dfe5410427a2e50c5321216a6426a88934bd943527406df361c6221bea78dd0311d5aaf9592b02c64e8
6
+ metadata.gz: 07eeae942b4f325c3ef4032505f96a82164ef142cc746bcf670ae88fa20a6d56a97bb3599fde37a0a33025f943bb5e9f1127dbee851d9e5cde4e680701429727
7
+ data.tar.gz: 7898894a8aa10a0e0265424dc928ef50d192319ab6141dc7a510909feedf608aa6f0e2da08af6df219079292547e80c9d0cd4a99aad2b8dfd70f0cadaae075d4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 2.6.7
data/lib/grit_ext.rb CHANGED
@@ -14,11 +14,11 @@ module GritExt
14
14
 
15
15
  # if message is utf-8 encoding, just return it
16
16
  message.force_encoding("UTF-8")
17
- return ensure_encoding(message) if message.valid_encoding?
17
+ return message if message.valid_encoding?
18
18
 
19
19
  # return message if message type is binary
20
20
  detect = CharlockHolmes::EncodingDetector.detect(message)
21
- return ensure_encoding(message.force_encoding("BINARY")) if detect && detect[:type] == :binary
21
+ return message.force_encoding("BINARY") if detect && detect[:type] == :binary
22
22
 
23
23
  # encoding message to detect encoding
24
24
  if detect && detect[:encoding]
@@ -26,22 +26,15 @@ module GritExt
26
26
  end
27
27
 
28
28
  # encode and clean the bad chars
29
- message = message.replace clean(message)
30
- ensure_encoding(message)
29
+ message.replace clean(message)
31
30
  rescue
32
31
  encoding = detect ? detect[:encoding] : "unknown"
33
32
  "--broken encoding: #{encoding}"
34
33
  end
35
34
 
36
- private
37
-
38
35
  def clean(message)
39
36
  message.encode("UTF-16BE", :undef => :replace, :invalid => :replace, :replace => "")
40
37
  .encode("UTF-8")
41
38
  .gsub("\0".encode("UTF-8"), "")
42
39
  end
43
-
44
- def ensure_encoding(message)
45
- message.encode('UTF-8', :invalid => :replace, :undef => :replace, :replace => "")
46
- end
47
40
  end
data/lib/grit_ext/diff.rb CHANGED
@@ -16,7 +16,11 @@ module Grit
16
16
  lines = @diff.lines.to_a
17
17
  path = GritExt.encode! lines.shift(2).join
18
18
  body = GritExt.encode! lines.join
19
- @diff = path + body
19
+ begin
20
+ @diff = path + body
21
+ rescue Encoding::CompatibilityError
22
+ @diff = GritExt.clean(path) + GritExt.clean(body)
23
+ end
20
24
  end
21
25
  end
22
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-grit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.6
4
+ version: 2.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-05-08 00:00:00.000000000 Z
13
+ date: 2014-05-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: charlock_holmes