From 37c3a38bb192491fb02347e45a6e6a2f2747834f Mon Sep 17 00:00:00 2001 From: LaZzyMan Date: Mon, 9 Feb 2026 14:23:37 +0800 Subject: [PATCH] fix: use centralized getProjectHash in Storage class Ensures consistent Windows path normalization across all path hashing. Previously Storage used its own getFilePathHash() which didn't apply Windows lowercase normalization, causing test failures on Windows CI. --- packages/core/src/config/storage.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/core/src/config/storage.ts b/packages/core/src/config/storage.ts index 8ef0283c5..4a710daf0 100644 --- a/packages/core/src/config/storage.ts +++ b/packages/core/src/config/storage.ts @@ -6,8 +6,8 @@ import * as path from 'node:path'; import * as os from 'node:os'; -import * as crypto from 'node:crypto'; import * as fs from 'node:fs'; +import { getProjectHash } from '../utils/paths.js'; export const QWEN_DIR = '.qwen'; export const GOOGLE_ACCOUNTS_FILENAME = 'google_accounts.json'; @@ -88,7 +88,7 @@ export class Storage { } getProjectTempDir(): string { - const hash = this.getFilePathHash(this.getProjectRoot()); + const hash = getProjectHash(this.getProjectRoot()); const tempDir = Storage.getGlobalTempDir(); return path.join(tempDir, hash); } @@ -105,12 +105,8 @@ export class Storage { return this.targetDir; } - private getFilePathHash(filePath: string): string { - return crypto.createHash('sha256').update(filePath).digest('hex'); - } - getHistoryDir(): string { - const hash = this.getFilePathHash(this.getProjectRoot()); + const hash = getProjectHash(this.getProjectRoot()); const historyDir = path.join(Storage.getGlobalQwenDir(), 'history'); return path.join(historyDir, hash); }