Patch -- escape rather than forbid percent sign in cmd_list_keys
Nathan Schmidt
nschmidt at gmail.com
Fri Jan 26 22:24:13 UTC 2007
We've got user files with percent signs in their names ( '/example/
attachments/Giving 100%.pdf/1159845419', '/example/attachments/Giving
100%.pdf/1159849299' ) and doing a key enumeration on attachment
revisions failed due to the percent-sign trapping. This change allows
those through but translates them to '%%'.
Regards,
-Nathan Schmidt / PBwiki
Index: trunk/server/lib/MogileFS/Worker/Query.pm
===================================================================
--- trunk/server/lib/MogileFS/Worker/Query.pm (revision 725)
+++ trunk/server/lib/MogileFS/Worker/Query.pm (working copy)
@@ -475,10 +475,13 @@
return $self->err_line('after_mismatch')
if $after && $after !~ /^$prefix/;
- # verify there are no % or \ characters
+ # verify there are no \ characters
return $self->err_line('invalid_chars')
- if $prefix =~ /[%\\]/;
+ if $prefix =~ /[\\]/;
+
+ # escape '%' literal == '%%', not wildcard
+ $prefix =~ s/%/%%/g;
+
# escape underscores
$prefix =~ s/_/\\_/g;
}
More information about the mogilefs
mailing list