Add query to TLE download filename, to avoid clashes. Fixes #1647

pull/1673/head
Jon Beniston 2023-04-28 08:01:02 +01:00
rodzic 485986acec
commit 02f264f275
1 zmienionych plików z 12 dodań i 1 usunięć

Wyświetl plik

@ -847,8 +847,19 @@ QString SatelliteTracker::tleURLToFilename(const QString& string)
{
if (string == "https://db.satnogs.org/api/tle/")
return satNogsTLEFilename();
// Celestrak now uses the same filename with different queries, so we need to include the query
// in the file name, so the filenames don't clash. E.g:
// https://celestrak.org/NORAD/elements/gp.php?GROUP=gps-ops&FORMAT=tle
// https://celestrak.org/NORAD/elements/gp.php?GROUP=active&FORMAT=tle
QUrl url(string);
return HttpDownloadManager::downloadDir() + "/tle_" + url.fileName();
QString fileName = HttpDownloadManager::downloadDir() + "/tle_" + url.fileName();
if (url.hasQuery())
{
QString query = url.query().replace('%', '_').replace('&', '_').replace('=', '_');
fileName = fileName + query;
}
return fileName;
}
void SatelliteTracker::downloadFinished(const QString& filename, bool success)