nappup 1.5.9 → 1.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +2 -2
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "git+https://github.com/44billion/nappup.git"
7
7
  },
8
8
  "license": "MIT",
9
- "version": "1.5.9",
9
+ "version": "1.5.10",
10
10
  "description": "Nostr App Uploader",
11
11
  "type": "module",
12
12
  "scripts": {
package/src/index.js CHANGED
@@ -185,8 +185,8 @@ async function uploadBinaryDataChunks ({ nmmr, signer, filename, chunkLength, lo
185
185
  }, relays)).result
186
186
 
187
187
  if (storedEvents.length > 0) {
188
- // Since results are desc sorted by created_at, the first one is the max
189
- maxStoredCreatedAt = Math.max(maxStoredCreatedAt, storedEvents[0].created_at)
188
+ const batchMaxCreatedAt = storedEvents.reduce((m, e) => Math.max(m, (e && typeof e.created_at === 'number') ? e.created_at : 0), 0)
189
+ if (batchMaxCreatedAt > maxStoredCreatedAt) maxStoredCreatedAt = batchMaxCreatedAt
190
190
  }
191
191
  }
192
192