Blank anchor [[#|anchor link]] should not link to the Main Page
OpenPublic

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 added a project: MediaWiki-Parser.Via ConduitNov 21 2014, 10:23 PM
bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz17006.
bzimport created this task.Via LegacyJan 13 2009, 6:28 PM
brion added a comment.Via ConduitJan 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

Mr.Z-man added a comment.Via ConduitJan 13 2009, 9:01 PM

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.Via ConduitJan 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.Via ConduitJan 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.

Krinkle added a comment.Via ConduitJul 1 2012, 8:46 PM
  • Bug 26766 has been marked as a duplicate of this bug. ***
Krinkle added a comment.Via ConduitJul 1 2012, 8:47 PM
  • Bug 32728 has been marked as a duplicate of this bug. ***
Krinkle added a comment.Via ConduitJul 1 2012, 8:47 PM
  • Bug 23799 has been marked as a duplicate of this bug. ***
Krinkle added a comment.Via ConduitJul 1 2012, 8:47 PM
  • Bug 34545 has been marked as a duplicate of this bug. ***
Krinkle added a comment.Via ConduitJul 1 2012, 8:48 PM
  • Bug 33437 has been marked as a duplicate of this bug. ***
Krinkle added a comment.Via ConduitJul 1 2012, 8:48 PM
  • Bug 38103 has been marked as a duplicate of this bug. ***
Aklapper added a comment.Via ConduitJan 23 2013, 9:54 AM

Still valid in 1.21wmf8.

Aklapper added a comment.Via ConduitJan 23 2013, 9:54 AM
  • Bug 44270 has been marked as a duplicate of this bug. ***
bzimport added a comment.Via ConduitJan 24 2013, 1:35 PM

danny.b wrote:

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.

matmarex added a comment.Via ConduitJan 24 2014, 6:21 PM
  • Bug 58647 has been marked as a duplicate of this bug. ***
Umherirrender added a comment.Via ConduitJan 24 2014, 8:29 PM

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)

Umherirrender removed a subscriber: Umherirrender.Via WebFeb 24 2015, 7:50 PM

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.