Last modified: 2013-07-02 14:12:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T49059, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 47059 - Setting default value of form field to a URL results in HTML markup in field value
Setting default value of form field to a URL results in HTML markup in field ...
Status: UNCONFIRMED
Product: MediaWiki extensions
Classification: Unclassified
SemanticForms (Other open bugs)
REL1_20-branch
PC Linux
: Unprioritized major (vote)
: ---
Assigned To: Yaron Koren
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-09 23:06 UTC by Al Johnson
Modified: 2013-07-02 14:12 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Al Johnson 2013-04-09 23:06:28 UTC
Hi,

When doing the following:

{{{field |url |text |default=http://sdf.com?xxx=yyy&zzz=aaa |maxlength=3000 |mandatory}}}

and when loading the form, the form field value gets set to:

<a rel="nofollow" class="external free" href="http://sdf.com?xxx=yyy&amp;zzz=aaa">http://sdf.com?xxx=yyy&amp;zzz=aaa</a>

instead of the proper unformatted value:

http://sdf.com?xxx=yyy&zzz=aaa

I tried wrapping the default value with <nowiki> but that doesn't work.

PLEASE NOTE: The description of how to reproduce above is just the most isolated way.  Realistically, I'm actually setting the default dynamically with {{#urlget:...}} like so:

default={{#urldecode: {{#urlget:url}} }}

But, I removed the urlget, and urldecode, just to isolate the problem and hard-coding the default to a URL produces the same problem exactly.

Thanks,
Al
Comment 1 Al Johnson 2013-07-02 06:20:08 UTC
I'm not a php programmer, but I've done a little tracing and in SF_FormPrinter.php line 817 this is called:

   $default_value = $wgParser->recursiveTagParse( $sub_components[1] );

and then the actual converting of the link to the marked-up version happens in Parser.php line 1166:

   $text = $this->doMagicLinks( $text );


Hope this helps.

Q: Just a guess, but should the default value be parsed as markup like it is?
Comment 2 Yaron Koren 2013-07-02 12:39:45 UTC
Yes, sometimes it makes sense to parse the default value - like when it contains an #ask query. It's really only when it holds a URL that problems seem to occur.
Comment 3 Al Johnson 2013-07-02 13:11:45 UTC
I'm musing on a private fix for this with a new param for the parser to skip the doMagicLinks() call.  Is the presence of '#ask' the only thing to test for?
Comment 4 Yaron Koren 2013-07-02 13:16:04 UTC
Well, if it's a private fix, it depends entirely on what's in your wiki.
Comment 5 Al Johnson 2013-07-02 14:04:13 UTC
I mean are there any other reasons, other than #ask, that a default value may need to be parsed?
Comment 6 Yaron Koren 2013-07-02 14:12:06 UTC
Sure - #ifexists, #time, #expr, #show....

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links