Commit 7536a81
committed
Fix Kobo sync downloading incorrect books due to stale temp files
The Kobo sync process was occasionally serving the wrong book content because of unsafe file handling in the temporary directory used for metadata embedding.
- Fixed `do_calibre_export` in `cps/embed_helper.py` to strictly match the requested filename (UUID) instead of returning the first file found with the correct extension.
- Added cleanup logic to `_convert_kepubify` in `cps/tasks/convert.py` to ensure temporary source files are deleted after conversion, preventing the accumulationFix Kobo sync downloading incorrect books due to stale temp files
The Kobo sync process was occasionally serving the wrong book content because of unsafe file handling in the temporary directory used for metadata embedding.
- Fixed `do_calibre_export` in `cps/embed_helper.py` to strictly match the requested filename (UUID) instead of returning the first file found with the correct extension.
- Added cleanup logic to `_convert_kepubify` in `cps/tasks/convert.py` to ensure temporary source files are deleted after conversion, preventing the accumulation of stale files.
This resolves the issue where multiple different books would download as the same book content on Kobo devices.1 parent 2f68a11 commit 7536a81
2 files changed
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | | - | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
239 | 244 | | |
240 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
241 | 252 | | |
242 | 253 | | |
243 | 254 | | |
| |||
0 commit comments