@@ -255,7 +255,6 @@ public static void findMods(Executor executor, HttpClient httpClient, IDiscovery
255255 LOGGER .info ("Found %,d local files in %,d ms" .formatted (repositoryFiles .size (), now - startTime ));
256256 startTime = now ;
257257
258- var packVersion = info .get ("version" ).getAsString ();
259258 var api = config .get ("api" ).getAsString ();
260259
261260 while (api .endsWith ("/" )) {
@@ -265,7 +264,7 @@ public static void findMods(Executor executor, HttpClient httpClient, IDiscovery
265264 var packCode = config .get ("pack_code" ).getAsString ();
266265 var auth = info .get ("auth" ).getAsString ();
267266
268- if ( auth .startsWith ("%" ) && auth .endsWith ("%" )) {
267+ while ( auth . length () >= 3 && auth .startsWith ("%" ) && auth .endsWith ("%" )) {
269268 auth = Optional .ofNullable (System .getenv (auth .substring (1 , auth .length () - 1 ))).orElse ("" );
270269 }
271270
@@ -297,7 +296,14 @@ public static void findMods(Executor executor, HttpClient httpClient, IDiscovery
297296 ignoredMods .add (e .getAsString ());
298297 }
299298
300- if (info .get ("pause_updates" ).getAsBoolean ()) {
299+ var packVersion = info .get ("version" ).getAsString ();
300+
301+ if (!packVersion .isEmpty () && !checkModsExist (repositoryFiles , info , ignoredMods )) {
302+ LOGGER .info ("Found missing or broken repository files, forcing an update..." );
303+ packVersion = "" ;
304+ }
305+
306+ if (!packVersion .isEmpty () && info .get ("pause_updates" ).getAsBoolean ()) {
301307 LOGGER .info ("Pack updates are paused ('" + packVersion + "')!" );
302308 loadMods (repositoryFiles , info , ignoredMods , pipeline );
303309
@@ -596,6 +602,29 @@ public static void findMods(Executor executor, HttpClient httpClient, IDiscovery
596602 loadMods (repositoryFiles , info , ignoredMods , pipeline );
597603 }
598604
605+ private static boolean checkModsExist (Map <String , RepositoryFile > repositoryFiles , JsonObject info , Set <String > ignoredMods ) {
606+ for (var entry : info .get ("mods" ).getAsJsonArray ()) {
607+ try {
608+ var fileInfo = new FileInfo (entry .getAsJsonObject ());
609+ var artifact = fileInfo .artifact ();
610+
611+ if (!artifact .isEmpty () && ignoredMods .contains (artifact )) {
612+ continue ;
613+ }
614+
615+ var repositoryFile = repositoryFiles .get (fileInfo .checksum ());
616+
617+ if (repositoryFile == null ) {
618+ return false ;
619+ }
620+ } catch (Exception ex ) {
621+ return false ;
622+ }
623+ }
624+
625+ return true ;
626+ }
627+
599628 private static void loadMods (Map <String , RepositoryFile > repositoryFiles , JsonObject info , Set <String > ignoredMods , IDiscoveryPipeline pipeline ) {
600629 var filesToLoad = new ArrayList <RepositoryFile >();
601630
0 commit comments