[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
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=215
Allow mixed case vgift tags.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
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 ) { --------------------------------------------------------------------------------