mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 06:01:12 +00:00
Make sure the last modified time for the GCDB is not in the future
This commit is contained in:
@@ -44,7 +44,10 @@ void MappingFetcher::start()
|
|||||||
// Only download the file if it's newer than what we have
|
// Only download the file if it's newer than what we have
|
||||||
QFileInfo existingFileInfo = Path::getCacheFileInfo("gamecontrollerdb.txt");
|
QFileInfo existingFileInfo = Path::getCacheFileInfo("gamecontrollerdb.txt");
|
||||||
if (existingFileInfo.exists()) {
|
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());
|
request.setHeader(QNetworkRequest::IfModifiedSinceHeader, existingFileInfo.lastModified().toUTC());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user