Closed chrusart closed 6 years ago
@chrusart Thanks, I see what you are saying. How likely would you say that would happen? Also, any idea how to change the logic to make it more robust?
Very rare. Probably you want to have human readable host part and have cache files separated from different hosts, then I would add some host hash to it at the end like: mysite_eie2uouo5eu42dioeu4/3oe2d16b4ae6u2ioe6ud5b.jpg
If you agree than I can make quick PR.
@chrusart Yeah, sure, This is a great idea! Thanks! :)
File path in cache is created using
getCachePath
which removes non alphanumerical signs from host, andgenerateCacheKey
which creates SHA1 from path (without host). If we will have the same file path (not so often, but...) on different hosts, the same file path will be created and previous one overwritten i guess. It can happen that the same file will be returned for different urls. I don't know what was the reason to remove non alphanumerical signs from host (i can guess), but this method (getCachePath
) should be changed.For example: mysi.te/photo.jpg my.site/photo.jpg or: 11.11.11.11/photo.jpg 1.111.1.11/photo.jpg will produce the same cache key (every photo.jpg has a different content).