From e36a09f3e8dfb654c74b1c51b80cbb21901ea49e Mon Sep 17 00:00:00 2001 From: Richard Weyer Date: Thu, 9 Oct 2025 13:48:55 +0200 Subject: [PATCH] fix: enforce strict .ograf.json extension for manifest files --- client/src/FileHandler.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/client/src/FileHandler.js b/client/src/FileHandler.js index 26c9ae5..7f0dd60 100644 --- a/client/src/FileHandler.js +++ b/client/src/FileHandler.js @@ -76,18 +76,22 @@ class FileHandler extends EventEmitter { async isManifestFile(filePath, getFileContents, strict) { // Note: The file name requirement was first added ~2025-06-13 (*.ograf), // and later (2025-07-02) changed to *.ograf.json. - if (strict) { - if (!filePath.endsWith('.ograf.json')) return null - } + // According to the OGraf specification, manifest files MUST end with .ograf.json - // Only support one of these extensions: - if ( - !filePath.endsWith('.manifest') && - !filePath.endsWith('.json') && - !filePath.endsWith('.ograf.json') && - !filePath.endsWith('.ograf') - ) - return null + // Only support .ograf.json extension (as per specification) + if (!filePath.endsWith('.ograf.json')) { + // For backward compatibility, also support legacy extensions if not in strict mode + if (strict !== false) { + return null + } + // Legacy support: also check for old extensions + if ( + !filePath.endsWith('.manifest') && + !filePath.endsWith('.json') && + !filePath.endsWith('.ograf') + ) + return null + } // Filter away some commonly known NOT manifest files: if (