fix: (regression 0.53.0) plugins/download-counter: first download was not counted

Massimo Melina committed Oct 10, 2024 at 12:46 UTC 764645356170f300b02cdb0948ec6db48f60d28a
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 = {
@@ -43,7 +43,7 @@ exports.init = async api => {
43 : ctx.state.originalStream?.getArchiveEntries?.().filter(x => x.at(-1) !== '/').map(x => key + uri2key(x))
44 if (!entries) return
45 for (const k of entries)
46 - db.put(k, db.getSync(k) + 1)
46 + db.put(k, db.getSync(k) + 1 || 1)
47 })
48 },
49 onDirEntry({ entry, listUri }) {