From 5c353c228969d470dfbf21c6d70b22efcd9db3e3 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sat, 13 May 2023 20:44:39 +0200 Subject: [PATCH] OTM: Attempt to deal with wonky config states (#10429) Such states (not quite sure how you could actively get in such a broken state to begin with, mind you) could lead to an attempt to load an old fontlist cache in an incompatible format. Re: #9771 --- frontend/ui/data/onetime_migration.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/ui/data/onetime_migration.lua b/frontend/ui/data/onetime_migration.lua index 9ee12ce89..a61fe82a0 100644 --- a/frontend/ui/data/onetime_migration.lua +++ b/frontend/ui/data/onetime_migration.lua @@ -32,6 +32,15 @@ end if last_migration_date < 20200421 then logger.info("Performing one-time migration for 20200421") + -- Drop the Fontlist cache early, in case it's in an incompatible format for some reason... + -- c.f., https://github.com/koreader/koreader/issues/9771#issuecomment-1546308746 + -- (This is basically the 20220914 migration step applied preemptively, as readertypography *will* attempt to load it). + local cache_path = DataStorage:getDataDir() .. "/cache/fontlist" + local ok, err = os.remove(cache_path .. "/fontinfo.dat") + if not ok then + logger.warn("os.remove:", err) + end + local ReaderTypography = require("apps/reader/modules/readertypography") -- Migrate old readerhyphenation settings -- (but keep them in case one goes back to a previous version)