Found the issue in Mage_Cms_Helper_Wysiwyg_Images::convertIdToPath
The core code is as follows.
public function convertIdToPath($id)
{
$path = $this->idDecode($id);
if (!strstr($path, $this->getStorageRoot())) {
$path = $this->getStorageRoot() . $path;
}
return $path;
}
And the fix is to use realpath when getting the storage root as follows.
public function convertIdToPath($id)
{
$path = $this->idDecode($id);
$realpath = $this->getStorageRoot();
if (is_link(rtrim($realpath,'/'))) {
$realpath = realpath($realpath);
}
if (!strstr($path, $realpath)) {
$path = $realpath . $path;
}
return $path;
}
So what we have done is to rewrite Mage_Cms_Helper_Wysiwyg_Images
and use the updated converIdToPath function. I found the original solution on a German website, but that will break if say you have a dev system without links and another system with a link.