A platform for community discussion. Free, open, simple.
FIX: mbox importer didn't detected already indexed files
Gerhard Schlager6500343431f3
diff --git a/script/import_scripts/mbox/support/indexer.rb b/script/import_scripts/mbox/support/indexer.rbindex e50f74449e7..d3980cd7253 100644--- a/script/import_scripts/mbox/support/indexer.rb+++ b/script/import_scripts/mbox/support/indexer.rb@@ -97,7 +97,8 @@ module ImportScripts::Mboxdef imported_file_checksums(category_name)rows = @database.fetch_imported_files(category_name)rows.each_with_object({}) do |row, hash|- hash[row['filename']] = row['checksum']+ filename = File.basename(row['filename'])+ hash[filename] = row['checksum']endend@@ -133,7 +134,7 @@ module ImportScripts::Mboxdef mark_as_fully_indexed(category_name, filename)imported_file = {category: category_name,- filename: filename,+ filename: File.basename(filename),checksum: calc_checksum(filename)}@@ -227,18 +228,18 @@ module ImportScripts::Mboxendend- def ignored_file?(filename, checksums)- filename = File.basename(filename)+ def ignored_file?(path, checksums)+ filename = File.basename(path)filename.start_with?('.') ||filename == METADATA_FILENAME ||IGNORED_FILE_EXTENSIONS.include?(File.extname(filename)) ||- fully_indexed?(filename, checksums)+ fully_indexed?(path, filename, checksums)end- def fully_indexed?(filename, checksums)+ def fully_indexed?(path, filename, checksums)checksum = checksums[filename]- checksum.present? && calc_checksum(filename) == checksum+ checksum.present? && calc_checksum(path) == checksumenddef calc_checksum(filename)