Page MenuHomePhabricator

Failure to get commentId in a wiki without short url setup
Closed, ResolvedPublic

Description

I'm trying to reply to a comment on my local wiki and I get the following error

Could not find the comment you're replying to on the page. It might have been deleted or moved to another page. Please reload the page and try again.

I think the culprit might be CommentUtils::getTitleFromUrl failing to generate a title and making CommentParser::findSignature return null.

URL: "./index.php%3Ftitle=User_talk:Admin"
See image for variable dump with xdebug

image.png (601×2 px, 294 KB)

I setup short url and it works fine. Maybe $wgArticlePath ?

Event Timeline

I tried locally with my $wgArticlePath commented out and I didn't get this problem.

I think something might be wrong with your wiki's configuration – from the screenshot, it seems that the function received $url equal to /mediawiki/index.php?title=index.php%3Ftitle=User_talk:Admin, which looks all kinds of wrong to me (why does 'index.php' appear twice, why does 'title=' appear twice, and why is there '%3F', which stands for '?', in the place where there should be '&'…).

When you look at the pages on the wiki with the browser's developer tools, do the links also look like that, or more normal? :D

What is your $wgArticlePath and $wgScriptPath?

I think something might be wrong with your wiki's configuration – from the screenshot,...

It is possible :) although everything else seems to work fine

That screenshot is a snapshot at line 313. By then $url was already changed on line 308 and this line is what's causing the issue I think.

The actual Url that gets passed in as a param is ./index.php%3Ftitle=User_talk:Admin

What is your $wgArticlePath and $wgScriptPath?

$wgScriptPath = null;
$wgArticlePath = "/mediawiki/index.php?title=$1"

When you look at the pages on the wiki with the browser's developer tools, do the links also look like that, or more normal? :D

Here is the markup for the link to the user's talk page

<a href="/mediawiki/index.php?title=User:Admin&amp;action=edit&amp;redlink=1" class="new" title="User:Admin (page does not exist)">Admin</a>

What is your $wgArticlePath and $wgScriptPath?

$wgScriptPath = null;
$wgArticlePath = "/mediawiki/index.php?title=$1"

Thanks, I can reproduce with similar configuration!

The problem occurs because of the query parameter in $wgArticlePath. MediaWiki is supposed to support that, and in fact that's the default value (if $wgUsePathInfo = false;), but Parsoid seems to handle it wrong.

I also see issues caused by that in VisualEditor:

image.png (1×3 px, 236 KB)

And directly in Parsoid output:
image.png (2×3 px, 387 KB)

The Parsoid output should have ? in that URL, rather than the encoded %3F.

@dmaza You can probably just remove your $wgArticlePath in the meantime, the wiki will then probably use URLs like "/mediawiki/index.php/$1" and they will probably work. ;)

Thanks, I can reproduce with similar configuration!

I'm glad I could help

@dmaza You can probably just remove your $wgArticlePath in the meantime, the wiki will then probably use URLs like "/mediawiki/index.php/$1" and they will probably work. ;)

Thanks. I went the short url route. Looks nicer :)

Change 623873 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/services/parsoid@master] Fix internal links without short URLs set up

https://gerrit.wikimedia.org/r/623873

Change 623874 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Fix parsing links in Parsoid documents without short URLs

https://gerrit.wikimedia.org/r/623874

I'm not sure if we actually want these patches, I'm just submitting them to discuss. This fixes the issue with DiscussionTools, but it turns out that a lot of other things in Parsoid and VisualEditor assume that short URLs are set up, and they're broken to varying degrees.

I guess we should probably fix all of those issues then, although they won't be high priority.

Change 623873 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Fix internal links without short URLs set up

https://gerrit.wikimedia.org/r/623873

Change 623874 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Fix parsing links in Parsoid documents without short URLs

https://gerrit.wikimedia.org/r/623874

matmarex claimed this task.

Should work now if you also update Parsoid to the latest master.

Change 628944 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.13.0-a10

https://gerrit.wikimedia.org/r/628944

Change 628944 merged by jenkins-bot:
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.13.0-a10

https://gerrit.wikimedia.org/r/628944