Defect #5939

Atom entry URL doesn't contain port

Added by Kirill Vasiliev over 11 years ago. Updated over 11 years ago.

Status:ClosedStart date:2010-07-22
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Feeds
Target version:-
Resolution:Cant reproduce Affected version:

Description

Host name in settings set to <ip-address>:3000, but all ATOM entries has URLs without ports.
It works if I change code as follows:


Index: app/views/common/feed.atom.rxml
===================================================================
--- app/views/common/feed.atom.rxml     (revision 3810)
+++ app/views/common/feed.atom.rxml     (working copy)
@@ -1,4 +1,7 @@
 xml.instruct!
+
+server_port = 3000
+
 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
   xml.title   truncate_single_line(@title, :length => 100)
   xml.link    "rel" => "self", "href" => url_for(params.merge(:only_path => false))
@@ -9,7 +12,7 @@
   xml.generator(:uri => Redmine::Info.url) { xml.text! Redmine::Info.app_name; }
   @items.each do |item|
     xml.entry do
-      url = url_for(item.event_url(:only_path => false))
+      url = url_for(item.event_url(:only_path => false, :port => server_port))
       if @project
         xml.title truncate_single_line(item.event_title, :length => 100)
       else

ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
Rails 2.3.5
Redmine 0.9.4.stable.3810 (SQLite)

History

#1 Updated by Felix Schäfer over 11 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

The host name setting is only used for the links in mails. The ATOM feed links are generated like every other link in redmine from the URL you are accessing it. The proposed patch also hard-codes the port, which is not desired behavior.

#2 Updated by Kirill Vasiliev over 11 years ago

  • Status changed from Closed to Reopened

It wasn't proposed patch, it was merely workaround demonstration. I'm sorry if I confuse you.

Some steps to reproduce:

  1. Install and run redmine on port 3000
  2. Create new project
  3. Go to the News tab
  4. Create new news article
  5. Hover on Atom link. The IP address will be http://&lt;address&gt;:3000/projects/&lt;project&gt;/news.atom?key=&lt;key>
  6. Click an Atom link and view the source of the feed generated. There will be entry like this:
      <entry>
        <title>title</title>
        <link href="http://<address>/news/2" rel="alternate"/>
        <id>http://<address>/news/1</id>
        <updated>2010-03-31T13:00:34+04:00</updated>
        <author>
          <name>name</name>
          <email>mail</email>
        </author>
        <content type="html">
          content
        </content>
      </entry>
    

    Note the URLs inside href attribute and id element doesn't contain port.

#3 Updated by Jean-Philippe Lang over 11 years ago

  • Category set to Feeds
  • Status changed from Reopened to Closed
  • Resolution changed from Invalid to Cant reproduce

Here is what I get with latest trunk. You can see the port number in URLs:

  <entry>
    <title>foo - Feature #4481 (New): Issue A1</title>
    <link href="http://192.168.199.129:3001/issues/4481" rel="alternate"/>
    <id>http://192.168.199.129:3001/issues/4481</id>
    <updated>2010-03-27T17:45:00+01:00</updated>
    <author>
      <name>Jean-Philippe Lang</name>
      <email>jp@somenet.foo</email>
    </author>
    <content type="html">
    </content>
  </entry>

Also available in: Atom PDF