Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
when viewing page node/123 , if this node doesn't exist, the front page is displayed instead of 404.
Comment | File | Size | Author |
---|---|---|---|
#13 | 82764.patch | 577 bytes | Wesley Tanaka |
#7 | node-not-found.2.diff | 984 bytes | beginner |
#4 | node-not-found.diff | 1.06 KB | beginner |
Comments
Comment #1
doq CreditAttribution: doq commentedComment #2
beginner CreditAttribution: beginner commentedno: 4.7.3 seems to work ok:
http://drupal.org/node/827645
(i.e. you get 'page not found').
Comment #3
doq CreditAttribution: doq commentedtry http://demo.opensourcecms.com/drupal/node/blablabla
Comment #4
beginner CreditAttribution: beginner commentedThis page handles node/$nid where $nid does not exist.
Does a callback already exist that simply returns drupal_not_found()?
I am not handling the case node/blahblah.
If you feel it should be handled, add a check on arg(1) at the beginning of the node_page_default() function, or add another callback in node_menu().
Patch against HEAD.
Comment #5
beginner CreditAttribution: beginner commentedA very similar problem exists with user/nnn.
Since the solution offered is very similar, it is worth considering merging the two patches into one: http://drupal.org/node/108579
Comment #6
RobRoy CreditAttribution: RobRoy commentedCouldn't we just make the menu callback 'drupal_not_found' since it now does the printing of the error, the footer then exits? Instead of having a wrapper callback?
Comment #7
beginner CreditAttribution: beginner commentedVery good. How silly of me!
Comment #8
joshk CreditAttribution: joshk commentedPatch applies clean, works as advertised and seems "right" to me.
Comment #9
drummhttp://drupal.org/node/108695
Comment #10
beginner CreditAttribution: beginner commentedI just updated to HEAD, and I find the symptoms to be the same as before.
The patch is still needed.
Comment #11
Wesley Tanaka CreditAttribution: Wesley Tanaka commentedalso dupe: http://drupal.org/node/90780
?
Comment #12
Wesley Tanaka CreditAttribution: Wesley Tanaka commentedIt seems to me like you could remove 'title' => t('View'), since that will get set by drupal_not_found(), and "View" doesn't make sense for a not found page anyway.
Comment #13
Wesley Tanaka CreditAttribution: Wesley Tanaka commentedI see that t('View')'s original pedigree was probably the View/Edit/Track/etc tabs. So I'm more confident that it's not useful here. New patch attached which is the same as http://drupal.org/files/issues/node-not-found.2.diff, but does not set 'title'
Comment #14
Wesley Tanaka CreditAttribution: Wesley Tanaka commentedactually, this patch only works if the thing following node/ is a number.
so node/cookie still gives the default node page with this patch, even if that path doesn't exist.
Comment #15
beginner CreditAttribution: beginner commentedActually, I already said in #4 that the patch only handles cases where we have an integer after node/...
This is by far the most common case, and the easiest to handle without adding too much cruft.
How often do you have an alias "node/whatever"? But people do post links to nodes node/1234 which subsequently disappear (are deleted).
The patch is simple and solves a very common problem.
Comment #16
Wesley Tanaka CreditAttribution: Wesley Tanaka commentedIn my case, for some reason, googlebot got a hold of several different broken "/node/something" links (the correct path was: /something), and then it started going through the pager: /node/something?page=1, /node/something?page=2, . . . /node/something?page=983
Comment #17
drummThis is still inside
so 'node/non-numeric-gibberish' still goes to the front page.
Comment #18
deanypop CreditAttribution: deanypop commentedI'm just your average bear, but I'd like to bump the severity of this, since there is now an easily-exploitable way to get the drupal "welcome to your new site" page for any site that doesn't use the node/front page promotion combo.
In fact, this is worrisome for every site out there under 5.x, anyway, because of the failure to 404 non-existent pages.
But, you know, I can't fix it, so I'll go away now.
Comment #19
mr700 CreditAttribution: mr700 commentedsubscribint
Comment #20
toemaz CreditAttribution: toemaz commentedHaving the same issue with a 5.1 installation.
Comment #21
Gerhard Killesreiter CreditAttribution: Gerhard Killesreiter commentedhttp://drupal.org/node/90780