From edd2b7e17764497c3d8c8043a42d6197452d7cce Mon Sep 17 00:00:00 2001 From: Strycher Date: Wed, 29 Jul 2026 23:12:05 -0400 Subject: [PATCH] fix(#404): cache-bust config fetches so a re-import never serves stale raw.githubusercontent sits behind a CDN with a multi-minute TTL; a catalog edit followed by a quick re-import returned the OLD profile (reported: a removed region still showing as a change). Append a unique query param + no-cache headers so every catalog/profile fetch is fresh. Co-Authored-By: Claude Opus 4.8 --- lib/services/config_source_service.dart | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/services/config_source_service.dart b/lib/services/config_source_service.dart index 71608202..2ba7f7eb 100644 --- a/lib/services/config_source_service.dart +++ b/lib/services/config_source_service.dart @@ -79,7 +79,22 @@ class ConfigSourceService { Future _get(String url) async { final http.Response resp; try { - resp = await _client.get(Uri.parse(url)); + // Cache-bust: config fetches must never serve a stale catalog/profile + // (raw.githubusercontent sits behind a CDN with a multi-minute TTL, so a + // re-import right after a catalog edit could otherwise return the old + // file). A unique query param guarantees a cache miss; the no-cache + // headers are belt-and-braces. + final base = Uri.parse(url); + final busted = base.replace( + queryParameters: { + ...base.queryParameters, + '_': DateTime.now().millisecondsSinceEpoch.toString(), + }, + ); + resp = await _client.get( + busted, + headers: const {'Cache-Control': 'no-cache', 'Pragma': 'no-cache'}, + ); } catch (e) { throw ConfigSourceException('Could not reach $url: $e'); }