Skip to content

Commit

Permalink
Temporary, incomplete fix for superfluous RSS/Atom encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMightyBuzzard committed Oct 17, 2014
1 parent 6eebaa9 commit 0033e2f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Slash/XML/RSS/RSS.pm
Expand Up @@ -325,6 +325,8 @@ sub create {
my $data = $item->{$key};
if ($key eq 'link') {
$data = _tag_link($data);
$encoded_item->{$key} = $data;
next;
}
$encoded_item->{$key} = $self->encode($data, $key);
}
Expand Down Expand Up @@ -392,8 +394,9 @@ sub rss_story {
my $other_creator;
my $action;

$encoded_item->{title} = $story->{title};
$encoded_item->{title} = $self->encode($story->{title})
if $story->{title};
if $story->{title} && $atom;
if ($story->{sid}) {
my $edit = "admin.pl?op=edit&sid=$story->{sid}";
my $linktitle = $story->{title};
Expand Down
17 changes: 13 additions & 4 deletions themes/default/tasks/open_backend.pl
Expand Up @@ -110,6 +110,15 @@ sub _do_rss {
} if $newurl;
}

# Undo all encoding and let xmlDisplay handle that
foreach my $item (@items) {
foreach("title","introtext","bodytext"."link"){
$item->{story}{$_} =~ s/\&#(\d+);/chr($1)/ge;
$item->{story}{$_} =~ s/\&#x([a-fA-F0-9]+);/chr(hex($1))/ge;
$item->{story}{$_} =~ s/\&/&/g;
}
}

my $rss = xmlDisplay($type, {
channel => {
title => $title,
Expand All @@ -125,11 +134,11 @@ sub _do_rss {

save2file("$constants->{basedir}/$filename", $rss, \&fudge);

# Now write change the links to https, add an s to the front of the extension, and write it again
# Now write change the links to https, add an s to the front of the extension, and write it again

$filename =~ s/\./.s/;
$rss =~ s/http:/https:/g;
save2file("$constants->{basedir}/$filename", $rss, \&fudge);
$filename =~ s/\./.s/;
$rss =~ s/http:/https:/g;
save2file("$constants->{basedir}/$filename", $rss, \&fudge);
}

sub newrdf { _do_rss(@_, '0.9') } # RSS 0.9
Expand Down

0 comments on commit 0033e2f

Please sign in to comment.