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] changelog2012-03-13 06:54 pm

[dw-free] Fix some user remapping

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

Fix some user remapping

If someone had an LJ user tag with a trailing slash that did not have
quotes, we would include the slash in the username. No more, I say! This
will fix some issues with importing entries ending up with bad tags.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm
--------------------------------------------------------------------------------
diff -r 9970a9c7dc2f -r 82baebb440e9 cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm
--- a/cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm	Tue Mar 13 18:31:54 2012 +0800
+++ b/cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm	Tue Mar 13 18:56:57 2012 +0000
@@ -296,7 +296,7 @@
 
 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)=["']?(.+?)["' ]?(?:\s*\/\s*)?>)/<user site="$data->{hostname}" $2="$3">/gi;
     return $event;
 }
 
--------------------------------------------------------------------------------