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.
This commit is contained in:
LaZzyMan 2026-02-09 14:23:37 +08:00
parent 32e17f8b58
commit 37c3a38bb1

View file

@ -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);
}