Escape URLs properly

This commit is contained in:
Citlali del Rey 2022-11-12 16:33:27 -08:00
parent 2b060366f0
commit 0c61594252
Signed by: nullobsi
GPG Key ID: 933A1F44222C2634
3 changed files with 7 additions and 4 deletions

View File

@ -219,6 +219,8 @@ sub get_entry($fullpath) {
return undef;
}
my $url = Mojo::URL->new("https://unix.dog/announcement/");
$url->path(basename($fullpath));
return {
raw => $announce_content,
@ -226,6 +228,7 @@ sub get_entry($fullpath) {
date => $filestat->mtime,
filename => basename($fullpath),
title => $announce_title,
url => $url,
};
}

View File

@ -19,7 +19,7 @@
<h2><%= $entry->{"title"} %></h2>
<p>
Posted <%= localtime($entry->{"date"})->strftime() %>.
<a href="/announcement/<%= $entry->{"filename"} %>">Download PGP signature.</a>
<a href="<% $entry->{url} %>">Download PGP signature.</a>
<p>
<pre><%= $entry->{"text"} %></pre>
</article>

View File

@ -15,10 +15,10 @@
% foreach my $item (@$items) {
<item>
<title><![CDATA[<%= $item->{'title'} %>]]></title>
<link>https://unix.dog/announcement/<%= $item->{'filename'} %></link>
<guid isPermaLink="true">https://unix.dog/announcement/<%= $item->{'filename'} %></guid>
<link><%= $item->{'url'} %></link>
<guid isPermaLink="true"><%= $item->{'url'} %></guid>
<description><![CDATA[<%== $item->{'text'} %>]]></description>
<author>Alpha</author>
<author>alpha@unix.dog</author>
<pubDate><%= localtime($item->{'date'})->strftime("%a, %d %b %Y %H:%M:%S %z") %></pubDate>
</item>
% }