mediawiki-slack
mediawiki-slack copied to clipboard
No protocol in URL in Slack message
Under Slack, I received messages like this : <//wiki.domain.com/wiki/index.php/pageName>_ modified by _userName*.
The protocol was missing in the URL (probably because of a specific configuration on my wiki).
I modified the extension's code in Slack.hooks.php, line 66 from : // Build the message we're going to post to Slack. $message = '<'.SlackHooks::encodeSlackChars($wikiPage->getTitle()->getFullURL()) .'|'.SlackHooks::encodeSlackChars($wikiPage->getTitle()).'> ' .$verb.' by *';
To : // Build the message we're going to post to Slack. $message = '<'.SlackHooks::encodeSlackChars($wikiPage->getTitle()->getFullURL('', false, PROTO_CURRENT)) .'|'.SlackHooks::encodeSlackChars($wikiPage->getTitle()).'> ' .$verb.' by *';
And it solved my problem. I now get proper Slack messages. I did not investigate if this change could break the extension on other wikis so I create an issue instead of a pull request...
Is $wgServer set correctly in your LocalSettings.php?
Hum you're right it's: $wgServer = "//wiki.server.com"; $wgCanonicalServer = "https://wiki.server.com";
But this config should be supported: https://www.mediawiki.org/wiki/Manual:$wgServer https://www.mediawiki.org/wiki/Manual:$wgCanonicalServer