fix: (regression 0.53.0) plugins/download-counter: first download was not counted
Massimo Melina committed
Oct 10, 2024 at 12:46 UTC
433f5104a957ed66203905652643d989624e7d20
1 file changed
+2
-2
plugins/download-counter/plugin.js
+2
-2
@@ -1,7 +1,7 @@
1
// other plugins can use ctx.state.download_counter_ignore to mark downloads that shouldn't be counted
2
3
exports.description = "Counts downloads for each file, and displays the total in the list or file menu"
4
-exports.version = 6 // new format
4
+exports.version = 6.1 // fix
5
exports.apiRequired = 8.89 // openDb
6
7
exports.config = {
@@ -28,7 +28,7 @@ exports.init = async api => {
28
: ctx.state.originalStream?.getArchiveEntries?.().filter(x => x.at(-1) !== '/').map(x => key + uri2key(x))
29
if (!entries) return
30
for (const k of entries)
31
- db.put(k, db.getSync(k) + 1)
31
+ db.put(k, db.getSync(k) + 1 || 1)
32
})
33
},
34
onDirEntry({ entry, listUri }) {