Commit d21d6401 authored by webchick's avatar webchick

#321063 by eMPee584, Kars-T: Fixed book/export/html/N with a non-book nid...

#321063 by eMPee584, Kars-T: Fixed book/export/html/N with a non-book nid should abort and return 404 not found.
parent 2748d654
......@@ -77,9 +77,11 @@ function book_export_html($nid) {
if (isset($node->book)) {
$tree = book_menu_subtree_data($node->book);
$contents = book_export_traverse($tree, 'book_node_export');
return theme('book_export_html', array('title' => $node->title, 'contents' => $contents, 'depth' => $node->book['depth']));
}
else {
drupal_not_found();
}
return theme('book_export_html', array('title' => $node->title, 'contents' => $contents, 'depth' => $node->book['depth']));
}
else {
drupal_access_denied();
......
......@@ -237,6 +237,10 @@ class BookTestCase extends DrupalWebTestCase {
$this->drupalGet('book/export/foobar/' . $this->book->nid);
$this->assertResponse('404', t('Unsupported export format returned "not found".'));
// Make sure we get a 404 on a not existing book node.
$this->drupalGet('book/export/html/123');
$this->assertResponse('404', t('Not existing book node returned "not found".'));
// Make sure an anonymous user cannot view printer-friendly version.
$this->drupalLogout();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment