mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 12:55:56 +00:00
fix url rewriting for videos with poster and src
if a poster attribute was present only that would have been rewritten and the (arguably more important) src attribute would be left as-is
This commit is contained in:
@@ -95,24 +95,21 @@ class DiskCache {
|
|||||||
|
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
|
|
||||||
if ($entry->hasAttribute('src') || $entry->hasAttribute('poster')) {
|
foreach (array('src', 'poster') as $attr) {
|
||||||
|
if ($entry->hasAttribute($attr)) {
|
||||||
|
// should be already absolutized because this is called after sanitize()
|
||||||
|
$src = $entry->getAttribute($attr);
|
||||||
|
$cached_filename = sha1($src);
|
||||||
|
|
||||||
// should be already absolutized because this is called after sanitize()
|
if ($cache->exists($cached_filename)) {
|
||||||
$src = $entry->hasAttribute('poster') ? $entry->getAttribute('poster') : $entry->getAttribute('src');
|
|
||||||
$cached_filename = sha1($src);
|
|
||||||
|
|
||||||
if ($cache->exists($cached_filename)) {
|
$src = $cache->getUrl(sha1($src));
|
||||||
|
|
||||||
$src = $cache->getUrl(sha1($src));
|
$entry->setAttribute($attr, $src);
|
||||||
|
|
||||||
if ($entry->hasAttribute('poster'))
|
|
||||||
$entry->setAttribute('poster', $src);
|
|
||||||
else {
|
|
||||||
$entry->setAttribute('src', $src);
|
|
||||||
$entry->removeAttribute("srcset");
|
$entry->removeAttribute("srcset");
|
||||||
}
|
|
||||||
|
|
||||||
$need_saving = true;
|
$need_saving = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user