mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
12 lines
222 B
Ruby
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
|