Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Anchor sids

  • Loading branch information...
commit fda1c295ac0f45938e48f57f40605cb2dc8033cc 1 parent 3e4e3c1
Chris Nandor authored
2  Slash/DB/MySQL/MySQL.pm
@@ -8749,7 +8749,7 @@ sub getStoidFromSidOrStoid {
8749 8749
 sub getStoidFromSid {
8750 8750
 	my($self, $sid) = @_;
8751 8751
 	return undef if !$sid;
8752  
-	return undef if $sid !~ regexSid();
  8752
+	return undef if $sid !~ regexSid(1);
8753 8753
 	if (my $stoid = $self->{_sid_conversion_cache}{$sid}) {
8754 8754
 		return $stoid;
8755 8755
 	}
4  Slash/Utility/Data/Data.pm
@@ -174,7 +174,9 @@ sub nick2matchname {
174 174
 # NOTE: sid is also used for discussion ID (and maybe stoid too?),
175 175
 # such as in comments.pl, so that's what the \d{1,8} is for. -- pudge
176 176
 sub regexSid {
177  
-	return qr{\b(\d{2}/\d{2}/\d{2}/\d{3,8}|\d{1,8})\b};
  177
+	my $anchor = shift;
  178
+	my $sid = '(\d{2}/\d{2}/\d{2}/\d{3,8}|\d{1,8})';
  179
+	return $anchor ? qr{^$sid$} : qr{\b$sid\b};
178 180
 }
179 181
 
180 182
 #========================================================================
2  Slash/Utility/Environment/Environment.pm
@@ -1871,7 +1871,7 @@ Hashref of cleaned-up data.
1871 1871
 		logtoken	=> sub { $_[0] = '' unless
1872 1872
 					 $_[0] =~ m|^\d+::[A-Za-z0-9]{22}$|		},
1873 1873
 		sid		=> sub { $_[0] = '' unless
1874  
-					 $_[0] =~ Slash::Utility::Data::regexSid()	},
  1874
+					 $_[0] =~ Slash::Utility::Data::regexSid(1)	},
1875 1875
 		flags		=> sub { $_[0] =~ s|[^a-z0-9_,]||g			},
1876 1876
 		query		=> sub { $_[0] =~ s|[\000-\040<>\177-\377]+| |g;
1877 1877
 			        	 $_[0] =~ s|\s+| |g;				},
2  plugins/Stats/Stats.pm
@@ -1347,7 +1347,7 @@ sub countDailyStoriesAccessRSS {
1347 1347
 		"op='slashdot-it' AND query_string LIKE '%from=rssbadge'",
1348 1348
 		'GROUP BY query_string');
1349 1349
 	my $sid_hr = { };
1350  
-	my $regex_sid = regexSid();
  1350
+	my $regex_sid = regexSid(1);
1351 1351
 	for my $qs (keys %$qs_hr) {
1352 1352
 		my($sid) = $qs =~ m{sid=\b([\d/]+)\b};
1353 1353
 		next unless $sid =~ $regex_sid;

0 notes on commit fda1c29

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