Delete the cached mappings if they are empty or corrupt

This commit is contained in:
Cameron Gutman
2020-11-23 18:34:53 -06:00
parent 861ebc151a
commit 3485983553
2 changed files with 23 additions and 8 deletions

View File

@@ -32,8 +32,13 @@ void MappingFetcher::start()
// Only download the file if it's newer than what we have
QFileInfo existingFileInfo = Path::getCacheFileInfo("gamecontrollerdb.txt");
if (existingFileInfo.exists() && existingFileInfo.size() > 0) {
request.setHeader(QNetworkRequest::IfModifiedSinceHeader, existingFileInfo.lastModified().toUTC());
if (existingFileInfo.exists()) {
if (existingFileInfo.size() > 0) {
request.setHeader(QNetworkRequest::IfModifiedSinceHeader, existingFileInfo.lastModified().toUTC());
}
else {
Path::deleteCacheFile("gamecontrollerdb.txt");
}
}
// We'll get a callback when this is finished