file_monitoring 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -144,6 +144,7 @@ module FileMonitoring
144
144
  super
145
145
  @dirs = nil
146
146
  @files = nil
147
+ @non_utf8_paths = {}
147
148
  end
148
149
 
149
150
  # Adds directory for monitoring.
@@ -257,6 +258,14 @@ module FileMonitoring
257
258
 
258
259
  # add and monitor new files and directories
259
260
  files.each do |file|
261
+ # keep only files with names in UTF-8
262
+ next if @non_utf8_paths[file]
263
+ check_utf_8_encoding_file = file.clone
264
+ unless check_utf_8_encoding_file.force_encoding("UTF-8").valid_encoding?
265
+ Log.warning("Non UTF-8 file name '#{check_utf_8_encoding_file}', skipping.")
266
+ @non_utf8_paths[file]=true
267
+ next
268
+ end
260
269
  file_stat = File.lstat(file) rescue nil
261
270
  if (file_stat.directory?)
262
271
  unless (has_dir?(file)) # new directory
@@ -1,3 +1,3 @@
1
1
  module FileMonitoring
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file_monitoring
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: