split get '/:link' with or without embedded pass
authorLunar <lunar@anargeek.net>
Mon, 2 Aug 2010 10:47:55 +0000 (12:47 +0200)
committerLunar <lunar@anargeek.net>
Mon, 2 Aug 2010 10:47:55 +0000 (12:47 +0200)
coquelicot.rb

index 02a4f58..37dfab2 100644 (file)
@@ -363,11 +363,11 @@ def send_stored_file(link, pass)
   throw :halt, [200, file]
 end
 
+get '/:link-:pass' do |link, pass|
+  not_found unless send_stored_file(link, pass)
+end
+
 get '/:link' do |link|
-  if link.include? '-'
-    link, pass = link.split '-'
-    not_found unless send_stored_file(link, pass)
-  end
   not_found unless depot.file_exists? link
   @link = link
   haml :enter_file_key