Author: AllenJB (AllenJB)
Committer: GitHub (web-flow)
Pusher: sy-records
Date: 2025-11-06T10:48:34+08:00
Commit: Reject old format indexes (forcing refetch) (#1596) · php/web-php@e619483 · GitHub
Raw diff: https://github.com/php/web-php/commit/e6194839e42347054ea396c5f215aa7ee01b9206.diff
Reject old format indexes (forcing refetch) (#1596)
Changed paths:
M js/search.js
Diff:
diff --git a/js/search.js b/js/search.js
index 807360ca99..6ef5008afe 100644
--- a/js/search.js
+++ b/js/search.js
@@ -28,6 +28,13 @@ const initPHPSearch = async (language) => {
const expireDate = cachedDate + CACHE_DAYS * MILLISECONDS_PER_DAY;
+ // Reject old format indexes
+ if (
+ (typeof data[0] !== 'object')
+ || Array.isArray(data[0])
+ ) {
+ return null;
+ }
if (Date.now() > expireDate) {
return null;
}