[dw-free] Fix issue with importer with invalid school names.
[commit: http://hg.dwscoalition.org/dw-free/rev/ee7f71ffe6de]
Fix issue with importer with invalid school names.
Patch by
mark.
Files modified:
Fix issue with importer with invalid school names.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm
-------------------------------------------------------------------------------- diff -r d4e35c18bc4f -r ee7f71ffe6de cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm --- a/cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm Mon Jul 06 00:21:06 2009 +0000 +++ b/cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm Mon Jul 06 03:55:12 2009 +0000 @@ -393,7 +393,15 @@ sub get_foaf_from { return undef unless ( $r && $r->is_success ); my $parser = new XML::Parser( Handlers => { Start => $foaf_handler, Char => $foaf_content, End => $foaf_closer } ); - $parser->parse( $r->content ); + + # work around a bug in the schools system that can lead to malformed wide characters + # getting put into the feed, breaking XML::Parser. we just strip out all of the school + # entries. if we ever need that data, we'll have to figure out how to fix the problem + # in a more sane fashion... + my $content = $r->content; + $content =~ s!<ya:school.+</foaf:Person>!</foaf:Person>!s; + + $parser->parse( $content ); return ( \%items, \@interests, \@schools ); } --------------------------------------------------------------------------------
no subject
no subject