fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-10-30 03:50 am

[dw-free] Implement v-gifts

[commit: http://hg.dwscoalition.org/dw-free/rev/fed283ba3487]

http://bugs.dwscoalition.org/show_bug.cgi?id=215

Allow mixed case vgift tags.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/VirtualGift.pm
--------------------------------------------------------------------------------
diff -r 690e8610d403 -r fed283ba3487 cgi-bin/DW/VirtualGift.pm
--- a/cgi-bin/DW/VirtualGift.pm	Sat Oct 30 11:45:56 2010 +0800
+++ b/cgi-bin/DW/VirtualGift.pm	Sat Oct 30 11:50:16 2010 +0800
@@ -32,6 +32,7 @@ sub _memcache_stored_props { return ( '1
 # end MemCacheable methods ###############################
 
 use Digest::MD5 qw/ md5_hex /;
+use LJ::Constants;
 use LJ::Event::VgiftApproved;
 
 
@@ -262,8 +263,18 @@ sub tags {
             $self->_tagwipe;
             return wantarray ? () : [];
         }
-        my @valid_tags = LJ::validate_interest_list( @newtags );
-        my %invalid_tags = map { lc( $_ ) => 1 } @newtags;
+
+        # make sure the tags we've specified are valid
+        my @valid_tags;
+        foreach my $tag ( @newtags ) {
+            my ( $bytes, $chars ) = LJ::text_length( $tag );
+            next if $bytes > LJ::BMAX_SITEKEYWORD;
+            next if $chars > LJ::CMAX_SITEKEYWORD;
+            next if $tag =~ /[\<\>]/;
+            push @valid_tags, $tag;
+        }
+
+        my %invalid_tags = map { $_ => 1 } @newtags;
         delete @invalid_tags{@valid_tags};
 
         if ( %invalid_tags ) {
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org