Ticket #358 (closed defect: wontfix)

Opened 7 weeks ago

Last modified 7 weeks ago

escape "|" inside parameters for API calls

Reported by: volker Owned by: jojo
Priority: blocker Component: mwlib
Keywords: Cc:

Description (last modified by ralf) (diff)

In [1]: from mwlib import wiki

In [2]: w=wiki.makewiki(':en')
2008-11-17T09:21:43 mwlib.utils.info >> fetching 'http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&format=json'

In [3]: w.wiki.getTemplate("BSkm| - |2.6")
2008-11-17T09:21:48 mwlib.utils.info >> fetching 'http://en.wikipedia.org/w/api.php?redirects=1&titles=Template:PrintBSkm|+-+|2.6&format=json&action=query&rvprop=content&prop=revisions'
Out[3]: u"{{Wiktionarypar|-}}\n'''-''' may refer to:\n* [[Hyphen]]\n* [[Plus and minus signs#Minus_sign|Minus sign]]\n* [[Hyphen-minus]]\n\n===See also===\n* [[Dash]]\n\n{{disambig}}\n\n[[cs:-]]\n[[de:Strich]]\n[[eo:Streko]]\n[[es:-]]\n[[fr:-]]\n[[ko:-]]\n[[he:-]]"

Change History

  Changed 7 weeks ago by ralf

  • description modified (diff)
  • summary changed from template expansion bug to mwapi returns wrong results for templates containing the pipe character

  Changed 7 weeks ago by ralf

  • summary changed from mwapi returns wrong results for templates containing the pipe character to mwapidb returns wrong results for templates containing the pipe character

  Changed 7 weeks ago by ralf

happens when expanding

{{BSkm{{!}} - {{!}}2.6}}

  Changed 7 weeks ago by ralf

  • status changed from new to closed
  • resolution set to wontfix

in reply to: ↑ description   Changed 7 weeks ago by jojo

Replying to volker:

In [3]: w.wiki.getTemplate("BSkm| - |2.6")

Why's WikiDB.getTemplate() called with this title? Isn't the title of the template just "BKsm", the rest are positional args?

  Changed 7 weeks ago by jojo

  • summary changed from mwapidb returns wrong results for templates containing the pipe character to getTemplate() is called with an invalid title

  Changed 7 weeks ago by jojo

  • status changed from closed to reopened
  • resolution deleted
  • summary changed from getTemplate() is called with an invalid title to escape "|" inside parameters for API calls

Got it. It's my bug.

Although I don't know, why this title is passed to getTemplate() in the first place (I also didn't really understand http://en.wikipedia.org/wiki/Template:!)

  Changed 7 weeks ago by jojo

  • owner changed from ralf to jojo
  • status changed from reopened to accepted

  Changed 7 weeks ago by ralf

It's not called anymore with a pipe symbol...

  Changed 7 weeks ago by jojo

Do you know if pipe symbols are allowed in regular titles (e.g. for articles etc.)?

  Changed 7 weeks ago by ralf

no, they are not. trying to access Main|:

Bad title
From Testwiki
Jump to: navigation, search

The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles. 

follow-up: ↓ 13   Changed 7 weeks ago by volker

just to clarify how the situation happend, this is how the markup looked like. btw. the markup does not display correctly in the mediawiki.

{{BS5|tCPICl|tCPICrSTR{{BSkm{{!}} - {{!}}2.6}}|{{ja-stalink|Kotake-Mukaihara}}| (Y-06)|}}

in reply to: ↑ 12   Changed 7 weeks ago by jojo

  • status changed from accepted to closed
  • resolution set to wontfix

Replying to volker:

just to clarify how the situation happend, this is how the markup looked like. btw. the markup does not display correctly in the mediawiki.

If it doesn't work in MediaWiki, I guess we can close this as wontfix.

follow-up: ↓ 15   Changed 7 weeks ago by volker

  • status changed from closed to reopened
  • resolution deleted

the problem is the way it fails in mediawiki and how it fails with the parser:

the mediawiki pretty much just interprets the whole thing as plain text. the mwlib parser in contrast expands it in a faulty way, with the result that an enormous amount of other templates are included. --> the parser adds content that is not there. therefore I still think this is a serious problem that should be fixed. also the parsetree contains total bogus which can not be rendered by the writers

in reply to: ↑ 14   Changed 7 weeks ago by jojo

Replying to volker:

the mwlib parser in contrast expands it in a faulty way, with the result that an enormous amount of other templates are included.

Shouldn't happen anymore after Ralf's changeset.

  Changed 7 weeks ago by ralf

  • status changed from reopened to closed
  • resolution set to wontfix
Note: See TracTickets for help on using tickets.