Files
openfoodnetwork/app/services/file_path_sanitizer.rb
David Cook 360a241402 Style fix
2023-05-18 10:07:52 +10:00

12 lines
222 B
Ruby

# frozen_string_literal: true
class FilePathSanitizer
def sanitize(file_path, on_error: nil)
pathname = Pathname.new(file_path)
return pathname.realpath if pathname.file?
on_error&.call
false
end
end