Skip to content

calibre: escape dot in gsub pattern for series index cleanup#15037

Merged
Frenzie merged 1 commit into
koreader:masterfrom
msk:fix/calibre-search-gsub-pattern
Feb 25, 2026
Merged

calibre: escape dot in gsub pattern for series index cleanup#15037
Frenzie merged 1 commit into
koreader:masterfrom
msk:fix/calibre-search-gsub-pattern

Conversation

@msk

@msk msk commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

In bookCatalog(), the .00 suffix is stripped via:

catalog[index].text = entry.text:gsub(".00", "", 1)

Because . in Lua patterns matches any character, the following happens:

series_index before gsub actual result expected result
1 00001.00 01.00 00001
42 00042.00 42.00 00042
100 00100.00 00.00 00100

This PR fixes it by escaping the dot: "%.00" matches a literal period followed by two zeros.


This change is Reviewable

The unescaped `.` in `".00"` matches any character followed by two
zeros. For a series entry like `"00001.00 | Title - Author"`, the
pattern matches `000` at position 1 instead of the intended literal
`.00` at position 6, producing `"01.00 | Title - Author"`.

Escape as `"%.00"` to match a literal period.
@Frenzie Frenzie added this to the 2026.02 milestone Feb 25, 2026
@Frenzie Frenzie added the Plugin label Feb 25, 2026
@Frenzie Frenzie merged commit 3e796f3 into koreader:master Feb 25, 2026
4 checks passed
@msk msk deleted the fix/calibre-search-gsub-pattern branch March 3, 2026 18:39
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
…r#15037)

The unescaped `.` in `".00"` matches any character followed by two
zeros. For a series entry like `"00001.00 | Title - Author"`, the
pattern matches `000` at position 1 instead of the intended literal
`.00` at position 6, producing `"01.00 | Title - Author"`.

Escape as `"%.00"` to match a literal period.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants