Blank anchor [[#|anchor link]] should not link to the Main Page
Open, NormalPublic

Description

Author: charlottethewebb

Description:
# or foobar links to a null page name rather than a null section. The example links point to http://en.wikipedia.org/wiki/ which redirects to the main page.

(except for ## which points to the current url plus "#.23")

As far as html literalism goes the least astonishing behavior for # would be to make a link like this <a href="#">#</a>

that would be the same as "#top" except in cases where it is overridden by a javascript onClick attribute (which it is, most times you see anything like this).

course if there's some way to make it turn blue and clickable but not actually do anything that might be best... i'm not sure when this would intentionally be used except when attempting to create a blue link that does nothing ever.

That's how i stumbled upon it after all :-/


Version: 1.21.x
Severity: trivial
URL: http://en.wikipedia.org/w/index.php?oldid=263850468
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=45583

bzimport set Reference to bz17006.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Jan 13 2009, 6:28 PM
brion added a comment.Jan 13 2009, 6:34 PM

Probably a bad check for fragments somewhere.... perhaps in multiple places. It should indeed be possible to add an empty fragment but _have_ a fragment... which perhaps complicates things. :D

I've tracked it down to Title::getLinkUrl(), the problem is that Title stores fragments without the leading #, then adds it back on when making a URL (Title::getFragmentForURL()), so it doesn't know the difference between a blank fragment and no fragment at all. So when making the URL, it sees no namespace, no text, and no fragment.

brion added a comment.Jan 13 2009, 9:06 PM

We could use false or null to distinguish between empty string and not-present... but then we have to be more anal about all the checks... or replace the != '' etc with a hasFragment() which'll be easier to remember.

brion added a comment.Jan 16 2009, 7:00 PM

We could also probably reasonably assume that if we've ended up with an empty title object, it's a self-link with empty fragment, so could handle it as a special case.

  • Bug 26766 has been marked as a duplicate of this bug. ***
  • Bug 32728 has been marked as a duplicate of this bug. ***
  • Bug 23799 has been marked as a duplicate of this bug. ***
  • Bug 34545 has been marked as a duplicate of this bug. ***
  • Bug 33437 has been marked as a duplicate of this bug. ***
  • Bug 38103 has been marked as a duplicate of this bug. ***

Still valid in 1.21wmf8.

  • Bug 44270 has been marked as a duplicate of this bug. ***

Raising the importance according to the number of dupes - obviously very wanted feature and more and more actual when we create more and more gadgets nowadays.

  • Bug 58647 has been marked as a duplicate of this bug. ***

Title::hasFragment as mention by brion in comment 3 was added with gerrit 104750, so checking against false or null would be possible (for core)

Add Comment