summaryrefslogtreecommitdiff
path: root/modules/book
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-28 08:04:59 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-28 08:04:59 +0000
commitd21d6401130b3e2e5e5418ccc82fb765d84f7ffb (patch)
tree218c36f835dbfbe3af9f7580bdaff2b6bd4092cf /modules/book
parent2748d654c41add71b0505933b113e2082804edc7 (diff)
downloadbrdo-d21d6401130b3e2e5e5418ccc82fb765d84f7ffb.tar.gz
brdo-d21d6401130b3e2e5e5418ccc82fb765d84f7ffb.tar.bz2
#321063 by eMPee584, Kars-T: Fixed book/export/html/N with a non-book nid should abort and return 404 not found.
Diffstat (limited to 'modules/book')
-rw-r--r--modules/book/book.pages.inc6
-rw-r--r--modules/book/book.test4
2 files changed, 8 insertions, 2 deletions
diff --git a/modules/book/book.pages.inc b/modules/book/book.pages.inc
index 3e682ef20..f6f7b0e85 100644
--- a/modules/book/book.pages.inc
+++ b/modules/book/book.pages.inc
@@ -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();
diff --git a/modules/book/book.test b/modules/book/book.test
index c797b7bad..6ac63f060 100644
--- a/modules/book/book.test
+++ b/modules/book/book.test
@@ -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();