I'm not entirely sure of the interactions here. I have a view that, on its own, works fine. Adding an RSS feed to it also works fine, and the feed has the correct URL.

However, if the view is then placed into a Panel, the URL of the feed is not my/view/url/feed but my/view/url/. That breaks the RSS feed. I have not yet tried it with viewfield, but I suspect it may happen there as well (with the view "embedded" in another page).

I've confirmed that the panel has no override URL set for the view.

CommentFileSizeAuthor
#3 empty_arg.patch655 bytesCrell
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Crell’s picture

I have confirmed that the same problem exists when a view is presented through a viewfield. The RSS link points to the URL of the view rather than the URL of the view plus /feed.

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

I tried this with panels and the frontpage feed, and that one works fine. This indicates there is something more about your view that may be involved here, but I'm not sure where to start.

Crell’s picture

Version: 5.x-1.5 » 5.x-1.x-dev
Status: Postponed (maintainer needs more info) » Needs review
FileSize
655 bytes

Well I tracked down the source of the problem, I believe.

In view_node.inc, there's this function:

function views_post_view_make_args($view, $feed_id, $arg) {
  // assemble the URL
  $args = array();
  foreach ($view->argument as $id => $argdata) {
    if (isset($view->args[$id])) {
      $args[] = $view->args[$id];
    } else {
      if ($argdata['id'] == $feed_id) {
        $args[] = $arg;
      }
      else if ($argdata['argdefault'] != 1) {
        $args[] = '*';
      }
    }
  }
  
  return $args;
}

Note the isset() check. The problem is that if you are using a view through a viewfield or panel, the argument field will (sometimes?) be set to empty string if you're not specifying anything. Empty string is not null, therefore the isset() returns true, and the code dutifully returns "" as the argument to append.

By changing the isset check to if (!empty($view->args[$id])) {, it gracefully handles both NULL and empty string, thus giving the correct default.

Patch attached against 5.x-dev.

merlinofchaos’s picture

Status: Needs review » Fixed

There is also a corresponding isset() in views_post_view_make_url() that needed fixing as well; so I went ahead and did both. Thanks for finding this!

Applied to both 5.x and 4.7.x

Anonymous’s picture

Status: Fixed » Closed (fixed)