lib/archival/helper_server.rb in archival-0.0.11 vs lib/archival/helper_server.rb in archival-0.0.12

- old
+ new

@@ -148,12 +148,17 @@ output = [0b10000001, message.size, message] @socket.write output.pack("CCA#{message.size}") end def serve_static(client, path, base = @build_dir) - buffer = File.open(File.join(base, path)).read - buffer.sub! '$PORT', @port.to_s - client.print buffer + full_path = File.join(base, path) + if File.file? full_path + buffer = File.open(full_path).read + buffer.sub! '$PORT', @port.to_s + client.print buffer + else + client.print 'Unknown File' + end end def http_response(client, config) status = config[:status] ||= 200 type = config[:type] ||= 'text/html'