You are here: Foswiki>Tasks Web>Item13795 (31 Jan 2018, GeorgeClark)Edit Attach

Item13795: Redundant url params generated by %SCRIPTURLPATH macro.

pencil
Priority: Urgent
Current State: Closed
Released In: 2.1.1
Target Release: patch
Applies To: Engine
Component:
Branches: master Release02x01 Item14033 Item13897 Item14380 Item14537
Reported By: MichaelDaum
Waiting For:
Last Change By: GeorgeClark
Current definition of %SCRIPTURL and friends macro using parameters renders them pretty useless.

You type:

%SCRIPTURLPATH{topic="Foo.Bar"}%

You get:

/bin/view/Foo/Bar?topic=Foo.Bar

You should get:

/bin/view/Foo/Bar

You type:

%SCRIPTURLPATH{web="Foo" topic="Foo.Bar"}%

You get:

/bin/view/Foo/Bar?topic=Foo.Bar;web=Foo

You should get:

/bin/view/Foo/Bar

You type:

%SCRIPTURLPATH{web="Foo" topic="Baz.Bar"}%

You get:

/bin/view/Foo/Bar?topic=Baz.Bar;web=Foo

You should get:

/bin/view/Baz/Bar

-- MichaelDaum - 05 Oct 2015

In thinking about this, there is a related issue. I suspect the macro really needs a subject= and verb= option to support the rest script. %SCRIPTURLPATH{"rest" subject="SomePlugin" verb="doit" topic="Web.Blah"}% Probably needs a feature proposal, but I didn't want to lose the thought.

-- GeorgeClark - 06 Oct 2015

Sure REST is different, but not the rest.

-- MichaelDaum - 06 Oct 2015

Remember that SCRIPTURL and SCRIPTURLPATH in 1.1.9 only documented the use of SCRIPTURL{"script} and that still works and is backwards compatible.

When I look at the feature proposal (I did not read it back then) AddWebParamToAllCgiScripts it seems that Sven's motivation was to enable user entry without having to resort to inline JS.

If adding web="webname" and topic="topicname" just appends the /web/topic to the path or url then I fail to see the point of the feature. Why not just write SCRIPTURL{"script"}/web/topic?

I am sure Sven had an idea with the web= and topic= as parameters and not append the path. Actually I cannot see in the original proposal that the path with be appended with /web/topic. You'd better go back and find out why the feature was added to 2.0 in the first place.

-- KennethLavrsen - 08 Oct 2015

Thats the wrong feature request. The enhancements to %SCRIPTURL has got nothing to do with adding web to CGI scripts.

See the discussions at DeprecateContextlessURLConstructs and EnableCloudStorageForAttachments. None of them are accepted.

Looking back at the change sets implemting the enhancements it seems they are refering to a totally unrelated bug item. The feature simply sneaked in without much peer review.

-- MichaelDaum - 08 Oct 2015

I've changed the SCRIPTURL macro:
  • If action is rest* or jsonrpc, generates an error if any other arguments are provides:
    • Parameters are not supported when generating rest or jsonrpc URLs.
  • Any other action:
    • If topic= is copied to the path, it is deleted from the attributes.
    • If web= is used because topic= was missing the web component, it is deleted from the attributes.

Unit tests and documentation updated.

A complete solution will be covered by ContinueCanonicalSCRIPTURLDev

-- GeorgeClark - 22 Mar 2016
 
Topic revision: r16 - 31 Jan 2018, GeorgeClark
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