Board Thread:General Coding Help/@comment-9605025-20180428232938/@comment-27345308-20180501110302

Did you try using MediaWiki helper methods such as mw.util.getUrl or mw.util.wikiUrlencode?