Fix #3601: Broken URLs in /posts.atom feed.

This commit is contained in:
evazion
2018-04-05 16:46:23 -05:00
parent a432980f85
commit 9b62b78183

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"> <feed xmlns="http://www.w3.org/2005/Atom">
<title><%= Danbooru.config.app_name %><% if !params[:tags].blank? %>: <%= params[:tags] %><% end %></title> <title><%= Danbooru.config.app_name %><% if !params[:tags].blank? %>: <%= params[:tags] %><% end %></title>
<link href="http://<%= Danbooru.config.hostname %>/posts.atom?tags=<%= params[:tags] %>" rel="self"/> <link href="<%= posts_url(tags: params[:tags], format: :atom) %>" rel="self"/>
<link href="http://<%= Danbooru.config.hostname %>/posts?tags=<%= params[:tags] %>" rel="alternate"/> <link href="<%= posts_url(tags: params[:tags]) %>" rel="alternate"/>
<id>http://<%= Danbooru.config.hostname %>/posts.atom?tags=<%= params[:tags] %></id> <id><%= posts_url(tags: params[:tags], format: :atom) %></id>
<% if @posts.any? %> <% if @posts.any? %>
<updated><%= @posts[0].created_at.gmtime.xmlschema %></updated> <updated><%= @posts[0].created_at.gmtime.xmlschema %></updated>
<% end %> <% end %>
@@ -13,18 +13,18 @@
<% Danbooru.config.select_posts_visible_to_user(CurrentUser.user, @posts).each do |post| %> <% Danbooru.config.select_posts_visible_to_user(CurrentUser.user, @posts).each do |post| %>
<entry> <entry>
<title><%= post.presenter.humanized_essential_tag_string %></title> <title><%= post.presenter.humanized_essential_tag_string %></title>
<link href="http://<%= Danbooru.config.hostname %>/posts/<%= post.id %>" rel="alternate"/> <link href="<%= post_url(post) %>" rel="alternate"/>
<% if post.source =~ %r{\Ahttps?://} %> <% if post.source =~ %r{\Ahttps?://} %>
<link href="<%= post.source %>" rel="related"/> <link href="<%= post.source %>" rel="related"/>
<% end %> <% end %>
<id>http://<%= Danbooru.config.hostname %>/posts/<%= post.id %></id> <id><%= post_url(post) %></id>
<updated><%= post.created_at.gmtime.xmlschema %></updated> <updated><%= post.created_at.gmtime.xmlschema %></updated>
<summary><%= post.tag_string %></summary> <summary><%= post.tag_string %></summary>
<content type="xhtml"> <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">
<a href="http://<%= Danbooru.config.hostname %>/posts/<%= post.id %>"> <%= link_to post_url(post) do %>
<img src="http://<%= Danbooru.config.hostname %><%= post.preview_file_url %>"/> <%= image_tag post.preview_file_url %>
</a> <% end %>
<p><%= post.tag_string %></p> <p><%= post.tag_string %></p>
</div> </div>
</content> </content>