Skip to content
Browse files

Fix case where get form wasn't matching routes correctly if the form …

…was empty

The Query string matcher only matched ?w+++ and not just ?
  • Loading branch information...
1 parent 24da100 commit 4dcd48315e32ed83d8b5d6c10850bb287b69ba27 @quirkey quirkey committed Aug 20, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/sammy.js
View
6 lib/sammy.js
@@ -8,7 +8,7 @@
var Sammy,
PATH_REPLACER = "([^\/]+)",
PATH_NAME_MATCHER = /:([\w\d]+)/g,
- QUERY_STRING_MATCHER = /\?([^#]*)$/,
+ QUERY_STRING_MATCHER = /\?([^#]*)?$/,
// mainly for making `arguments` an Array
_makeArray = function(nonarray) { return Array.prototype.slice.call(nonarray); },
// borrowed from jQuery
@@ -1238,7 +1238,9 @@
verb = this._getFormVerb($form);
this.log('_checkFormSubmission', $form, path, verb);
if (verb === 'get') {
- this.setLocation(path + '?' + this._serializeFormParams($form));
+ params = this._serializeFormParams($form);
+ if (params !== '') { path += '?' + params; }
+ this.setLocation(path);
returned = false;
} else {
params = $.extend({}, this._parseFormParams($form));

0 comments on commit 4dcd483

Please sign in to comment.
Something went wrong with that request. Please try again.