While digging the code for image path name generation in Shopware 6, I found that they generate a MD5 sum and then remove certain values.
See here:
private $blacklist = [
'ad' => 'g0',
];
...
protected function generateMd5Path(string $fromValue): string
{
$md5hash = md5($fromValue);
$md5hashSlices = \array_slice(str_split($md5hash, 2), 0, 3);
$md5hashSlices = array_map(
function ($slice) {
return \array_key_exists($slice, $this->blacklist) ? $this->blacklist[$slice] : $slice;
},
$md5hashSlices
);
return implode('/', $md5hashSlices);
}
What can be the reason for such a code? What is so bad about "ad" ?
I believe image path's with "ad" in the name would be more likely to be blocked by adblockers.