From 750a0b5177a36b796bc7e199b4e677466fd021a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= <grosse@cosmocode.de>
Date: Thu, 19 Oct 2017 11:29:18 +0200
Subject: [PATCH] fix: link the old version in MM when view it

This commit fixes a bug in the media manager when viewing an old version
of a media file. While, in case of an image, the old image would be
displayed in the third pane, the link above would still link to the
current version.
---
 inc/template.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/inc/template.php b/inc/template.php
index fce1c0ccd..7b16b9142 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1391,7 +1391,8 @@ function tpl_mediaFileDetails($image, $rev) {
     list($ext) = mimetype($image, false);
     $class    = preg_replace('/[^_\-a-z0-9]+/i', '_', $ext);
     $class    = 'select mediafile mf_'.$class;
-    $tabTitle = '<strong><a href="'.ml($image).'" class="'.$class.'" title="'.$lang['mediaview'].'">'.$image.'</a>'.'</strong>';
+    $attributes = $rev ? ['rev' => $rev] : [];
+    $tabTitle = '<strong><a href="'.ml($image, $attributes).'" class="'.$class.'" title="'.$lang['mediaview'].'">'.$image.'</a>'.'</strong>';
     if($opened_tab === 'view' && $rev) {
         printf($lang['media_viewold'], $tabTitle, dformat($rev));
     } else {
-- 
GitLab