lib/roda/plugins/public.rb in roda-2.17.0 vs lib/roda/plugins/public.rb in roda-2.18.0
- old
+ new
@@ -39,11 +39,11 @@
module RequestMethods
# Serve files from the public directory if the file exists and this is a GET request.
def public
if is_get?
- path = PARSER.unescape(remaining_path)
+ path = PARSER.unescape(real_remaining_path)
return if path.include?(NULL_BYTE)
roda_opts = roda_class.opts
server = roda_opts[:public_server]
path = ::File.join(server.root, *public_path_segments(path))
@@ -87,10 +87,12 @@
# Return whether the given path is a readable regular file.
def public_file_readable?(path)
::File.file?(path) && ::File.readable?(path)
rescue SystemCallError
+ # :nocov:
false
+ # :nocov:
end
if ::Rack.release > '2'
# :nocov:
def public_serve(server, path)