Page MenuHomePhabricator

DocBookExport: Fails for links containing escaped characters
Open, MediumPublic

Description

When a link links to a page with a name containing an html-escaped character, the page name used by \DocBookExportAPI::getDocbookfromWikiPage will contain a "%" character, which is considered a malformed title. Consequently calling Title::newFromText on it will return null leading to

 /w/api.php?action=getdocbook&outputformat=pdf&bookname=Test Error from line 346 of /var/www/html/w/extensions/DocBookExport/DocBookExportAPI.php: Call to a member function exists() on null
Backtrace:
#0 /var/www/html/w/extensions/DocBookExport/DocBookExportAPI.php(71): DocBookExportAPI->getDocbookfromWikiPage(string, ParserOptions, string, array, array)
#1 /var/www/html/w/includes/api/ApiMain.php(1583): DocBookExportAPI->execute()
#2 /var/www/html/w/includes/api/ApiMain.php(546): ApiMain->executeAction()
#3 /var/www/html/w/includes/api/ApiMain.php(517): ApiMain->executeActionWithErrorHandling()
#4 /var/www/html/w/api.php(94): ApiMain->execute()
#5 {main}

Event Timeline

Thanks for reporting this. Do you know what should be the fix for this?

I used urldecode. Not sure if that's the correct way to do it, but it cures the symptom for this particular case.

Vvjjkkii renamed this task from DocBookExport: Fails for links containing escaped characters to mdbaaaaaaa.Jul 1 2018, 1:05 AM
Vvjjkkii removed Nischayn22 as the assignee of this task.
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii edited subscribers, added: Nischayn22; removed: Aklapper.
Yaron_Koren renamed this task from mdbaaaaaaa to DocBookExport: Fails for links containing escaped characters.Jul 2 2018, 1:33 AM
Yaron_Koren assigned this task to Nischayn22.
Yaron_Koren lowered the priority of this task from High to Medium.
Yaron_Koren updated the task description. (Show Details)
Yaron_Koren added a subscriber: Aklapper.
Yaron_Koren removed a subscriber: Nischayn22.
Aklapper added a subscriber: Nischayn22.

@Nischayn22: I am resetting the assignee of this task because there has not been progress lately (please correct me if I am wrong!). Resetting the assignee avoids the impression that somebody is already working on this task. It also allows others to potentially work towards fixing this task. Please claim this task again when you plan to work on it (via Add Action...Assign / Claim in the dropdown menu) - it would be welcome. Thanks for your understanding!