mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-04-05 07:43 am

[dw-free] Importer's remap_lj_user regex is incorrectly greedy.

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

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

Fix too-greedy regex in importer.

Patch by [personal profile] alierak.

Files modified:
  • cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm
--------------------------------------------------------------------------------
diff -r e58eff78e503 -r 244a398061ba cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm
--- a/cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm	Sun Apr 05 07:17:59 2009 +0000
+++ b/cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm	Sun Apr 05 07:43:21 2009 +0000
@@ -408,7 +408,7 @@ sub remap_username_friend {
 
 sub remap_lj_user {
     my ( $class, $data, $event ) = @_;
-    $event =~ s/(<lj.+?(user|comm|syn)=["']?(.+?)["' ]?>)/<lj site="$data->{hostname}" $2="$3">/gi;
+    $event =~ s/(<lj[^>]+?(user|comm|syn)=["']?(.+?)["' ]?>)/<lj site="$data->{hostname}" $2="$3">/gi;
     return $event;
 }
 
--------------------------------------------------------------------------------

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