Skip to content

Instantly share code, notes, and snippets.

@metavida
Created August 13, 2009 18:50
Show Gist options
  • Save metavida/167384 to your computer and use it in GitHub Desktop.
Save metavida/167384 to your computer and use it in GitHub Desktop.
A simple patch of the mongrel_upload_progress gem that allows us to use regular expressions in the :path_info parameter.
--- lib/mongrel_upload_progress/init.rb
+++ lib/mongrel_upload_progress/init.rb
@@ -32,8 +32,8 @@
private
def upload_notify(action, params, *args)
- return unless @path_info.include?(params['PATH_INFO']) &&
- params[Mongrel::Const::REQUEST_METHOD] == 'POST' &&
+ return unless params[Mongrel::Const::REQUEST_METHOD] == 'POST' &&
+ @path_info.detect { |r| r.is_a?(Regexp) ? r =~ params['PATH_INFO'] : r == params['PATH_INFO'] } &&
upload_id = Mongrel::HttpRequest.query_parse(params['QUERY_STRING'])['upload_id']
if action == :mark
last_checked_time = Mongrel::Uploads.last_checked(upload_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment