Last modified: 2012-11-06 14:44:22 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 T43275, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 41275 - External links no longer handled correctly in query templates
External links no longer handled correctly in query templates
Status: RESOLVED DUPLICATE of bug 39392
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
master
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-22 17:03 UTC by Yaron Koren
Modified: 2012-11-06 14:44 UTC (History)
2 users (show)

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


Attachments

Description Yaron Koren 2012-10-22 17:03:48 UTC
I don't know if this is due to SMW 1.8 or MW 1.20, but when using "template=" in #ask queries, external links aren't getting parsed (though internal links still get handled fine). You can see the problem here, for example, in all the attempted "view" links:

http://discoursedb.org/wiki/2011_Egyptian_protests_/_Hosni_Mubarak_should_step_down

The relevant queries are here:

http://discoursedb.org/w/index.php?title=Template:Position&action=edit

...and here's the template they call:

http://discoursedb.org/w/index.php?title=Template:ItemQuery&action=edit
Comment 1 Markus Krötzsch 2012-10-22 17:19:29 UTC
I think this is caused by "  |link=subject" in the query, which advises SMW to avoid links in all parameters other than the subject. For URLs, this can only be done by escaping the URL so that MediaWiki won't autolink it. Unfortunately, this also prevents explicit linking.

The change that caused this is https://bugzilla.wikimedia.org/show_bug.cgi?id=39392

Maybe this change needs to be augmented to get the desired behaviour. Is there any way to craft a string that will no be linked by MW by default, but will be linkable when put into [ ]?
Comment 2 Yaron Koren 2012-10-22 18:50:16 UTC
That is indeed tricky. Might it work to add in a call like $parser->replaceExternalLinks() on the text? As far as I can tell, that function only handles URLs within brackets, not bare URLs.
Comment 3 Markus Krötzsch 2012-10-22 20:27:34 UTC
I don't see how this would help. If we called replaceExternalText on our output, we could only ensure that it gets linked (make links right away). What we need to do is to ensure that it does not get linked, unless surrounded by [ ]. But since this processing happens after we returned the string, I don't see how we can influence it with replaceExternalLinks() in the case where we do not want a link.

One option would be to have two outputformats: one to get the plain string, one to get the escaped (nolink) string. In theory, the format "-" should rather return the plain string than an escaped one, so that it can really be used like raw data. How should the format for escaping be called? Would "nolink" make sense?
Comment 4 Yaron Koren 2012-10-22 20:33:05 UTC
Maybe you misunderstood I meant? What I mean is, in cases where URLs don't get linked (i.e., "link=subject" or "link=none"), you call replaceExternalLinks() after the other processing is done. That way, URLs in single brackets get linked, while URLs not in brackets stay unlinked.
Comment 5 Markus Krötzsch 2012-10-22 20:42:47 UTC
But MW links all URLs, whether in brackets or not, after the page is built anyway. Unless replaceExternalLinks() protects link-like strings to avoid linking, this would still happen, wouldn't it? But as I understand you, replaceExternalLinks() adds more links rather than preventing links from being inserted.
Comment 6 Yaron Koren 2012-10-22 20:49:45 UTC
I don't understand - right before displaying the query results on the screen, can't you call replaceExternalLinks() on that text, to take care of the URLs in brackets? Or is there some escaping of the URLs in the text so that that won't work?
Comment 7 Markus Krötzsch 2012-10-27 21:38:10 UTC
To prevent autolinking in MW, we replace : with an HTML escape. But after this, the string is no longer a URL. As I understand, replaceExternalLinks() does not accomplish anything that MW would not do with the returned text anyway.
Comment 8 Yaron Koren 2012-10-27 22:11:05 UTC
Ah - that's the part I didn't know about it. Still, I bet after the main parsing is done, you could replace it back, then call replaceExternalLinks(). There may be easier ways to do it, but I think this would work.
Comment 9 Markus Krötzsch 2012-11-06 14:44:22 UTC
I agree with you that the current escaping is not feasible. We need to find a better solution. I am marking this as a duplicate of Bug 39392 now, since it is one discussion we need to have for both issues.

*** This bug has been marked as a duplicate of bug 39392 ***

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


Navigation
Links