simple_captcha_guard 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5384f71624d510527ba7207c1764ecc2e43a668e6de9df865833d2caa8a545f1
4
- data.tar.gz: b2d02535c1dfa151071b48ce4d4339cf7579c3c05907fe02b015c01e5cbaba85
3
+ metadata.gz: cf26abb57e6accc5c7872b5b06a17720a15add4aaec41d6ecadbbc95ed645063
4
+ data.tar.gz: 520da0d4b5ddb3571d371678905d5acd4ccebf607a0079b55780a09d9b990ccf
5
5
  SHA512:
6
- metadata.gz: 32a6525b8b681d8b840926e1a4e2d2fa3519ec62320b1894e4e8584cabd7933a2a10ffbec1678a6a42b9f691a976e76f58f057f01423340d95138e4d41d05d4b
7
- data.tar.gz: b4e97de1cf3f83c110023355e1f621bca0112502e402fe29ae69d49d863d5b1111532739d6395161d7cc61ef7c5e0d8b0451441ebfe74109388202b000e655ba
6
+ metadata.gz: 0ebb3ca57a5ed88ae65e02704346b3ee64f68cbe5388f55145109095c6ac2a08a8276be4f57d3732544b9f17f004209e24af6cefdceadebe444922f171565ec4
7
+ data.tar.gz: 0a8bf64ac878ed0998270ae18c42d77fe301cac4a9fa7360322e766bf797198f11ae661e0214fba0229d7b13e33c4596f3f1c87e49ac7a135f3a42a58d1a4895
@@ -33,15 +33,20 @@ module SimpleCaptchaGuard
33
33
  convert << "png:-"
34
34
  end
35
35
 
36
- # `image` is a String: either image data or a filename
37
- # If it's a filename, read and return the binary data
38
- if image.is_a?(String) && File.exist?(image)
39
- File.binread(image)
40
- else
41
- image
36
+ if image.is_a?(String)
37
+ if image.include?("\0")
38
+ # Definitely binary image data
39
+ return image
40
+ else
41
+ # No null bytes, probably a file path, so check file existence safely
42
+ return File.binread(image) if File.exist?(image)
43
+ end
42
44
  end
45
+
46
+ image
43
47
  end
44
48
 
45
49
 
50
+
46
51
  end
47
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_captcha_guard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmed Mahir Tazwar