lib/yard/server/commands/static_file_command.rb in yard-0.6.8 vs lib/yard/server/commands/static_file_command.rb in yard-0.7.0
- old
+ new
@@ -15,11 +15,11 @@
# document root will always take precedence over these paths.
STATIC_PATHS = [
File.join(YARD::TEMPLATE_ROOT, 'default', 'fulldoc', 'html'),
File.join(File.dirname(__FILE__), '..', 'templates', 'default', 'fulldoc', 'html')
]
-
+
def run
path = File.cleanpath(request.path).gsub(%r{^(../)+}, '')
([adapter.document_root] + STATIC_PATHS.reverse).compact.each do |path_prefix|
file = File.join(path_prefix, path)
if File.exist?(file)
@@ -30,12 +30,12 @@
end
end
favicon?
self.status = 404
end
-
+
private
-
+
# Return an empty favicon.ico if it does not exist so that
# browsers don't complain.
def favicon?
return unless request.path == '/favicon.ico'
self.headers['Content-Type'] = 'image/png'
\ No newline at end of file