From 80cee8367f27d1083e99bf0880733c21868ba322 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 24 Nov 2020 00:18:34 -0600 Subject: [PATCH] Make sure the last modified time for the GCDB is not in the future --- app/settings/mappingfetcher.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/settings/mappingfetcher.cpp b/app/settings/mappingfetcher.cpp index 07d4314a..f70a7981 100644 --- a/app/settings/mappingfetcher.cpp +++ b/app/settings/mappingfetcher.cpp @@ -44,7 +44,10 @@ void MappingFetcher::start() // Only download the file if it's newer than what we have QFileInfo existingFileInfo = Path::getCacheFileInfo("gamecontrollerdb.txt"); if (existingFileInfo.exists()) { - if (existingFileInfo.size() > 0) { + // Make sure the cached file looks reasonable. It should have some data and + // the last modified time should not be in the future. + QDateTime lastModifiedTime = existingFileInfo.lastModified().toUTC(); + if (existingFileInfo.size() > 0 && lastModifiedTime <= QDateTime::currentDateTimeUtc()) { request.setHeader(QNetworkRequest::IfModifiedSinceHeader, existingFileInfo.lastModified().toUTC()); } else {