[dw-free] site="dreamwidth.org" in user tag parsed as unknown external site
[commit: http://hg.dwscoalition.org/dw-free/rev/afe115ff71bd]
http://bugs.dwscoalition.org/show_bug.cgi?id=936
a) if site=x, with x being the local site is used, the tag will be treated
as though it has no site= attribute.
b) if other people use the Dreamwidth code, links to Dreamwidth with
site=dreamwidth.org are parsed correctly and get the correct icon.
Patch by
yvi.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=936
a) if site=x, with x being the local site is used, the tag will be treated
as though it has no site= attribute.
b) if other people use the Dreamwidth code, links to Dreamwidth with
site=dreamwidth.org are parsed correctly and get the correct icon.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/DW/External/Site.pm
- cgi-bin/cleanhtml.pl
-------------------------------------------------------------------------------- diff -r d12eef88e5a3 -r afe115ff71bd cgi-bin/DW/External/Site.pm --- a/cgi-bin/DW/External/Site.pm Thu Jul 02 02:44:30 2009 +0000 +++ b/cgi-bin/DW/External/Site.pm Thu Jul 02 03:52:21 2009 +0000 @@ -25,6 +25,7 @@ use DW::External::Site::JournalFen; use DW::External::Site::JournalFen; use DW::External::Site::Inksome; use DW::External::Site::DeadJournal; +use DW::External::Site::Dreamwidth; use DW::External::Site::Unknown; my %domaintosite; @@ -36,6 +37,8 @@ my %idtosite; $domaintosite{"deadjournal.com"} = DW::External::Site->new("4", "www.deadjournal.com", "deadjournal.com", "DeadJournal", "lj"); $domaintosite{"inksome.com"} = DW::External::Site->new("5", "www.inksome.com", "inksome.com", "Inksome", "lj"); $domaintosite{"journalfen.net"} = DW::External::Site->new("6", "www.journalfen.net", "journalfen.net", "JournalFen", "lj"); +$domaintosite{"dreamwidth.org"} = DW::External::Site->new("7", "www.dreamwidth.org", "dreamwidth.org", "Dreamwidth", "lj"); + foreach my $value (values %domaintosite) { $idtosite{$value->{siteid}} = $value; diff -r d12eef88e5a3 -r afe115ff71bd cgi-bin/cleanhtml.pl --- a/cgi-bin/cleanhtml.pl Thu Jul 02 02:44:30 2009 +0000 +++ b/cgi-bin/cleanhtml.pl Thu Jul 02 03:52:21 2009 +0000 @@ -490,7 +490,8 @@ sub clean exists $attr->{comm} ? $attr->{comm} : undef; # allow external sites - if ( my $site = $attr->{site} ) { + # do not use link to an external site if site attribute is current domain + if ( (my $site = $attr->{site}) && ($attr->{site} ne $LJ::DOMAIN) ) { # try to load this user@site combination if ( my $ext_u = DW::External::User->new( user => $user, site => $site ) ) { @@ -511,7 +512,7 @@ sub clean LJ::ehtml( LJ::no_utf8_flag( $site ) ) . "]</b>"; } - # failing that, no site, use the local behavior + # failing that, no site or local site, use the local behavior } elsif (length $user) { my $orig_user = $user; # save for later, in case $user = LJ::canonical_username($user); --------------------------------------------------------------------------------