From 8f1efc437b686ec79c258f63e550f7bfec5c2b06 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Fri, 15 Aug 2014 11:47:22 +0200
Subject: [PATCH] sanity check update message

This should avoid problems when a WiFi login redirect intercepts the
update check.
See https://forum.dokuwiki.org/post/45076
---
 inc/infoutils.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/inc/infoutils.php b/inc/infoutils.php
index db856141f..f9ba11560 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -30,7 +30,12 @@ function checkUpdateMessages(){
         $http = new DokuHTTPClient();
         $http->timeout = 12;
         $data = $http->get(DOKU_MESSAGEURL.$updateVersion);
-        io_saveFile($cf,$data);
+        if(substr(trim($data), -1) != '%') {
+            // this doesn't look like one of our messages, maybe some WiFi login interferred
+            $data = '';
+        }else {
+            io_saveFile($cf,$data);
+        }
     }else{
         dbglog("checkUpdateMessages(): messages.txt up to date");
         $data = io_readFile($cf);
-- 
GitLab