simple_captcha_guard 0.1.5 → 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: d82e15ea61e87a4d75a120089bb4b12f438781e33dc437ace2f68bfcdc9dabcc
4
- data.tar.gz: 3d2505a972681340ddaf891585ae1fc0cb0263779244368194d00506d6dab8d3
3
+ metadata.gz: cf26abb57e6accc5c7872b5b06a17720a15add4aaec41d6ecadbbc95ed645063
4
+ data.tar.gz: 520da0d4b5ddb3571d371678905d5acd4ccebf607a0079b55780a09d9b990ccf
5
5
  SHA512:
6
- metadata.gz: 6110a07a5ada6c8ea8602d037dd70185bbe08d6807a576bc1ee28aa51c5f82c21fb4f52ff60211f458a071f8539b1551af3a43a44378a2db49d1a6cd5df7d88f
7
- data.tar.gz: 2d492e08c4456b1388c01625cd208a2f48f6914ec3f61f214127b07930f0e65dc88a8de43e29ad2c7aa5d5f406011632cc853ae47e0d438967a9f12e3e5ce5e9
6
+ metadata.gz: 0ebb3ca57a5ed88ae65e02704346b3ee64f68cbe5388f55145109095c6ac2a08a8276be4f57d3732544b9f17f004209e24af6cefdceadebe444922f171565ec4
7
+ data.tar.gz: 0a8bf64ac878ed0998270ae18c42d77fe301cac4a9fa7360322e766bf797198f11ae661e0214fba0229d7b13e33c4596f3f1c87e49ac7a135f3a42a58d1a4895
@@ -33,16 +33,20 @@ module SimpleCaptchaGuard
33
33
  convert << "png:-"
34
34
  end
35
35
 
36
- # If image string contains null byte, it's binary data, so return it directly
37
- if image.is_a?(String) && image.include?("\0")
38
- image
39
- elsif image.is_a?(String) && File.exist?(image)
40
- File.binread(image)
41
- else
42
- 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
43
44
  end
45
+
46
+ image
44
47
  end
45
48
 
46
49
 
50
+
47
51
  end
48
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmed Mahir Tazwar