diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index b9d09fe..f8d2f55 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -11,7 +11,7 @@ class ApiController < ApplicationController unless File.file?(file) && File.readable?(file) return render json: [], status: 403 end - render json: file_tail(file) || [] + render json: file_tail(file) end def empty_json diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1091d98..cda9ba7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -101,10 +101,10 @@ class ApplicationController < ActionController::Base end def file_tail(path, limit = 10) - return unless path - return unless File.exists? path + return [] unless path + return [] unless File.exists? path reader = FileReverseReader.new(File.open(path)) - return if reader.binary_file? + return [] if reader.binary_file? reader.tail(limit) end end