Multiple files as bulleted list (encrypted file paths)

For multiple upload fields I used to be able to list the files like this:

//Grab files and display as bulleted links
        if ($this->PageID == "list" || $this->PageID == "view") { // List/View page only
        $GetItems = $this->Files->CurrentValue;
        if (!empty($GetItems)){
            $ar = explode(',', $GetItems);
            $sLink = "<ul>";
            foreach ($ar as $value){
            $sLink .= "<li><a data-toggle='tooltip' title='"."Ava fail"."' href='" . trim($value) . "' target='_blank'>Ava Fail</a>";
            }
            $this->Files->ViewValue = rtrim($sLink, ",</li>");
	$sLink .= "</ul>";
            unset($value);
        }
    }

But when I have file paths encrypted, this method doesn’t work as the files are rendered as original filenames rather than with the encrypted URL.
How can I get this working again?

This might help: How to rename multiple files and displayed it vertically (v2022)

Note that there is a template for showing files in layout.php, look for:

<!-- template download (for file upload) -->
<script id="template-download" type="text/html">

You may copy and csutomize it and put it in Page_Foot server event to override the original one.