- Affected version
- 2.0.4
Imgur has changed the ID length of album links, apparently. Now they're not 5 characters anymore, or at least sometimes they are not.
I'm pretty new to Xenforo but I found the bbcode helper for Imgur in src/XF/BbCode/Helper/Imgur.php
The code checks for album links just by seeing if the ID is 5 characters. The below code I changed it to do a string search for the imgur.com/a/ section that the album links seem to always contain. There may be more eloquent solutions, but this one was a quick fix.
I'm pretty new to Xenforo but I found the bbcode helper for Imgur in src/XF/BbCode/Helper/Imgur.php
The code checks for album links just by seeing if the ID is 5 characters. The below code I changed it to do a string search for the imgur.com/a/ section that the album links seem to always contain. There may be more eloquent solutions, but this one was a quick fix.
PHP:
public static function matchCallback($url, $matchedId, \XF\Entity\BbCodeMediaSite $site, $siteId)
{
// if (strlen($matchedId) == 5) // XXX: Xenforo 2.0.4 version
// hack 2018-04-20 fix new longer imgur links
if (strpos($url, 'imgur.com/a/'))
{
$matchedId = 'a/' . $matchedId;
}
return $matchedId;
}
Last edited: