[Scummvm-git-logs] scummvm-web master -> 0de6a475d3c9552a6c46e8acc9c4cb02c3bb9d7e

Thunderforge noreply at scummvm.org
Mon Nov 22 01:52:19 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .

Summary:
0de6a475d3 WEB: Fixing when the recommended download link is an external URL (#182)


Commit: 0de6a475d3c9552a6c46e8acc9c4cb02c3bb9d7e
    https://github.com/scummvm/scummvm-web/commit/0de6a475d3c9552a6c46e8acc9c4cb02c3bb9d7e
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2021-11-21T19:52:16-06:00

Commit Message:
WEB: Fixing when the recommended download link is an external URL (#182)

Changed paths:
    include/Models/DownloadsModel.php


diff --git a/include/Models/DownloadsModel.php b/include/Models/DownloadsModel.php
index 9e818f30..f67c5dd5 100644
--- a/include/Models/DownloadsModel.php
+++ b/include/Models/DownloadsModel.php
@@ -112,10 +112,15 @@ class DownloadsModel extends BasicModel
             $download = $downloads[0];
 
             $name = strip_tags($download->getName());
-            // Construct the URL and fill in the version
-            $url = DOWNLOADS_BASE . DOWNLOADS_URL . $download->getURL();
-            $version = $download->getVersion();
-            $url = str_replace('{$version}', $version, $url);
+            if (str_starts_with($download->getURL(), 'http')) {
+                $url = $download->getURL();
+                $url = str_replace('{$version}', $version, $url);
+            } else {
+                // Construct the URL and fill in the version
+                $url = DOWNLOADS_BASE . DOWNLOADS_URL . $download->getURL();
+                $version = $download->getVersion();
+                $url = str_replace('{$version}', $version, $url);
+            }
 
             $data = ""; //$download->getExtraInfo();
             if (is_array($data)) {




More information about the Scummvm-git-logs mailing list