file_monitoring 1.0.1 → 1.0.2
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.
@@ -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
|