Bug - Fixed Fix [wiki] link in right-click menu for items with multi-word names (updated)

philmasterplus

Active member
KoLmafia augments the right-click menu with a [wiki] link to the item's KoL wiki page. However, there's a small bug in the JavaScript code that handles item names with multiple spaces. It only replaces the first space character.

For example, the [wiki] link for Knob Goblin Pants leads to:
Code:
http://kol.coldfront.net/thekolwiki/index.php/Special:Search?go=Go&search=Knob+Goblin%20pants
...instead of the intended URL:
Code:
http://kol.coldfront.net/thekolwiki/index.php/Special:Search?go=Go&search=Knob+Goblin+pants

This may have worked in the past, but fails now due to the wiki's HTTP → HTTPS redirection issue (which also caused a similar issue in OCD Inventory Control.)

I'm submitting a patch that fixes this in two ways. Use encodeURIComponent() all the way instead of regexes, and (2) use a https:// URL.

Edit: Updated patch to handle issue discussed in reply #2
Edit 2021-01-09: Updated patch to resolve merge conflict after r20600
 

Attachments

  • philmasterplus-fix-wiki-link-renamed-2.patch
    2.6 KB · Views: 3
Last edited:

MCroft

Developer
Staff member
Do you need to bump ircm_extend.1.js to ircm_extend.2.js to prevent caching?

I just ran into that with another browser-based js file.
 

philmasterplus

Active member
You mean the issue discussed here? Whoops.

It seems that if there is already an (old) icrm_extend.1.js sitting inside the relay/ directory, then KoLmafia does not try to use the bundled (new) version. I renamed it to icrm_extend.2.js and also updated KoLConstants.java. Thanks for the heads up!

Tested with the dead guy's watch, Genalen™ Bottle , and bugged bön±Ã©t.

Incidentally, the [search] link doesn't work with the bugged bön±Ã©t, both before and after the patch.
 
Last edited:

philmasterplus

Active member
The previous patch resulted in a small conflict with r20600. I posted a fixed patch (filename philmasterplus-fix-wiki-link-renamed-2.patch) in the first post.
 
Top