[PHP-WEBMASTER] [web-php] master: Reject old format indexes (forcing refetch) (#1596)

[email protected] (AllenJB via GitHub)
Newsgroups php.webmaster
Message-ID <[email protected]>
Author: AllenJB (AllenJB)
Committer: GitHub (web-flow)
Pusher: sy-records
Date: 2025-11-06T10:48:34+08:00

Commit: https://github.com/php/web-php/commit/e6194839e42347054ea396c5f215aa7ee01b9206
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;
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.