Permalink
Browse files

checking for existence of f param

  • Loading branch information...
1 parent 1c62f6f commit ed78ea138fcb3781431b92ffc6cddc2c43cdd9d9 @sickill committed Mar 21, 2009
Showing with 1 addition and 1 deletion.
  1. +1 −1 sickounter.rb
View
@@ -2,7 +2,7 @@
require 'sinatra'
get '/' do
- url = params[:f]
+ url = params[:f] or raise Sinatra::NotFound
filename = url.gsub(/https?:\/\//, "").gsub(/[^a-zA-Z0-9_-]/, ".") + ".txt"
path = "counters/#{filename}"
val = (File.read(path).strip.to_i rescue 0) + 1

0 comments on commit ed78ea1

Please sign in to comment.