You are here: Foswiki>Tasks Web>Item446 (08 May 2010, KennethLavrsen)Edit Attach

Item446: Make redirectto aware of anchors in links

Priority: Normal
Current State: Closed
Released In: 1.0.9, 1.1.0
Target Release: patch
Applies To: Engine
Reported By: Foswiki:Main.ArthurClemens
Waiting For: Main.PaulHarvey
Last Change By: KennethLavrsen
There is a general lacking of support for anchor and query params in links.

Concrete item: the redirectto parameter does not understand Web.Topic#Anchor syntax.

Overall, anchor syntax is largely not supported. It should not be difficult to add anchors and query parameters to a topic notation. The question is largely: where to add it? has the subroutine _handleWikiWord. But this is not used by code. Instead it uses normalizeWebTopicName a lot. With a small change that function could also return anchor and params:

( $web, $topic, $paramList, $anchor ) = $this->normalizeWebTopicName( 'Web.Topic?q=123#MyAnchor' );

See also: Support.Question47.

-- ArthurClemens - 27 Jan 2009

See also: Item1245

-- CrawfordCurrie - 18 Mar 2009
Confirmed. However normalizeWebTopicName is not the place to add it; it relates to a topic name, not a general index, and is used in places where it would be quite inappropriate to do that.

Instead the params and anchor should be taken off only where it is appropriate to do so i.e. when parsing the target of a square bracket link, and when parsing a small subset of parameters such as redirectto. By all means provide a new function that fulfils the dual role of parsing off the args and normalizing the topic name, but don't muck with the existing normalizeWebTopicName function.

-- CrawfordCurrie - 06 Apr 2009

I have updated with a new function _splitAnchorFromUrl. Attached patch to incorporate in FW2.0:

What would be a good place for a unit test?

-- ArthurClemens - 20 Aug 2009

This was set "Waiting for release", but actually no checkins have been done.

Pending for a unit test.

Plus, I first regarded this as an enhancement, but it is a bug. For example with SendEmailPlugin after pressing submit, the redirect does not link to the feedback anchor with a possible error message. If that message is not in first view, it looks like the operation was succesful, while actually it failed. There must be a lot of other applications that rely on anchors that are now failing.

In other words, this fix should go into release branch as well.

-- ArthurClemens - 05 Jan 2010

Actually, I have no idea how to make a unit test for a redirect. I also cannot find any existing tests to guide me. Is this inherently difficult?

-- ArthurClemens - 05 Jan 2010

And the fix in the patch is not sufficient to deal with redirect_cache.

-- ArthurClemens - 05 Jan 2010

Better now. I have the fix ready for release branch as well.

-- ArthurClemens - 07 Jan 2010

Set this back to "New" (was closed). I assume this was supposed to be WaitingForRelease. But I've set back to new in case anybody has an idea on how to write the unit tests.

I've been hacking the REST stuff lately and I might have a go at it later next month, unless somebody tells me it's not possible.

-- PaulHarvey - 21 Apr 2010

It was closed because the bug was fixed and a release with the fix was released 1.0.9

This also means that the item should remain closed and a new bug raised if there is more related work. Otherwise people get confused when they click on the fixed bug list in the release notes and find a non closed bug.

And we get confused when we cannot identify in which release a bug is fixed.

And last we end up with same bug item in several releases.

Open a bug related to the unit tests which can be closed when fixed as unit tests are not part of the released product.

-- KennethLavrsen - 08 May 2010

ItemTemplate edit

Summary Make redirectto aware of anchors in links
ReportedBy Foswiki:Main.ArthurClemens
Codebase 1.0.9, 1.0.8, trunk
SVN Range TWiki-4.2.3, Wed, 06 Aug 2008, build 17396
AppliesTo Engine
Priority Normal
CurrentState Closed
WaitingFor PaulHarvey
Checkins distro:a8ab26f1b5a2 distro:4ebf78292e49 distro:e87bfb84c209 distro:ea8f61bf03bd distro:1a495cc4d9ed
TargetRelease patch
ReleasedIn 1.0.9, 1.1.0
Topic revision: r19 - 08 May 2010, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy