From 568bf9dd6fe5123d86b1736d73d6a404adc44fa6 Mon Sep 17 00:00:00 2001 From: neon <18559658+neonsolstice@users.noreply.github.com> Date: Sat, 11 Jul 2026 17:02:32 +0000 Subject: [PATCH] fix(kobo): strip leading v from server version in koreader plugin The KOReader plugin's update check response provides the server version, which already contains a leading "v". The update and plugin popups in the KOReader plugin format the version with an explicit "v" prefix, resulting in a "vv" typo (e.g. "vv1.2.0"). Strip the leading "v" from the server version in the updater script if present to ensure it is displayed with a single "v" prefix. Closes #644 --- koreader-plugin/bookorbit.koplugin/bookorbit_updater.lua | 2 +- .../src/modules/koreader/koreader-plugin-source.test.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/koreader-plugin/bookorbit.koplugin/bookorbit_updater.lua b/koreader-plugin/bookorbit.koplugin/bookorbit_updater.lua index f0b158889..1448fef65 100644 --- a/koreader-plugin/bookorbit.koplugin/bookorbit_updater.lua +++ b/koreader-plugin/bookorbit.koplugin/bookorbit_updater.lua @@ -211,7 +211,7 @@ function UpdateCheck:doCheckForUpdate() end function UpdateCheck:handleUpdateVersionResponse(body, interactive, prompt_allowed) - local server_ver = body.serverVersion or "unknown" + local server_ver = tostring(body.serverVersion or "unknown"):gsub("^v", "") local plugin_latest = body.pluginVersion self.settings.update_check_last_at = os.time() diff --git a/server/src/modules/koreader/koreader-plugin-source.test.ts b/server/src/modules/koreader/koreader-plugin-source.test.ts index 97a32fd01..d1ce97c21 100644 --- a/server/src/modules/koreader/koreader-plugin-source.test.ts +++ b/server/src/modules/koreader/koreader-plugin-source.test.ts @@ -182,6 +182,14 @@ describe('KOReader plugin update source wiring', () => { expect(updater).toContain('self.settings.update_dismissed_version = plugin_latest'); }); + it('renders the server version with exactly one v prefix in update dialogs', async () => { + const updater = await readPluginFile('bookorbit_updater.lua'); + + expect(updater).toContain('local server_ver = tostring(body.serverVersion or "unknown"):gsub("^v", "")'); + expect(updater).toContain('Plugin is up to date (v%1).\\nServer: v%2'); + expect(updater).toContain('Update available: v%1 -> v%2\\nServer: v%3'); + }); + it('runs a throttled update check after successful full-library sweeps', async () => { const main = await readPluginFile('main.lua'); const sweep = await readPluginFile('bookorbit_sweep.lua');