Skip to content

Commit

Permalink
🐛 Refactor: Fix file path access to prevent error (#966)
Browse files Browse the repository at this point in the history
- Centralized the import_file_path logic into a separate method
- Resolved TypeError caused by nil values when checking file existence
- Improved code readability and maintainability
  • Loading branch information
ShanaLMoore authored Aug 2, 2024
1 parent c58f870 commit fe15dde
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/models/bulkrax/importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,16 @@ def seen
@seen ||= {}
end

def import_file_path
self.parser_fields['import_file_path']
end

def original_file?
File.exist?(self.parser_fields['import_file_path'])
import_file_path && File.exist?(import_file_path)
end

def original_file
self.parser_fields['import_file_path'] if original_file?
import_file_path if original_file?
end

def replace_files
Expand Down

0 comments on commit fe15dde

Please sign in to comment.