1
0
Fork 0

Hotfix zstd version change only

pull/1353/head
Lovepreet Singh 2023-02-20 13:08:22 +00:00
parent 3630ea6eed
commit 9e06993ffc
1 changed files with 8 additions and 3 deletions

View File

@ -99,12 +99,17 @@ async function getVersion(app: string, args?: string[]): Promise<string> {
export async function getCompressionMethod(): Promise<CompressionMethod> { export async function getCompressionMethod(): Promise<CompressionMethod> {
const versionOutput = await getVersion('zstd', ['--quiet']) const versionOutput = await getVersion('zstd', ['--quiet'])
const version = semver.clean(versionOutput) const version = semver.clean(versionOutput)
if (version) {
if (versionOutput === '') {
// zstd is not installed
return CompressionMethod.Gzip
} else if (!version || semver.lt(version, 'v1.3.2')) {
// zstd is installed but using a version earlier than v1.3.2
// v1.3.2 is required to use the `--long` options in zstd
return CompressionMethod.ZstdWithoutLong return CompressionMethod.ZstdWithoutLong
} else { } else {
return CompressionMethod.Gzip return CompressionMethod.Zstd
} }
} }
export function getCacheFileName(compressionMethod: CompressionMethod): string { export function getCacheFileName(compressionMethod: CompressionMethod): string {