diff --git a/backend/services/admin-service/src/api/dto/request/upload-version.dto.ts b/backend/services/admin-service/src/api/dto/request/upload-version.dto.ts index d2918381..620c3966 100644 --- a/backend/services/admin-service/src/api/dto/request/upload-version.dto.ts +++ b/backend/services/admin-service/src/api/dto/request/upload-version.dto.ts @@ -34,12 +34,21 @@ export class UploadVersionDto { @ApiPropertyOptional({ description: '是否强制更新', default: false }) @IsOptional() - @Transform(({ value }) => { + @Transform(({ obj }) => { + // Access the raw value directly from the source object + // This bypasses enableImplicitConversion which incorrectly converts "false" string to true + const rawValue = obj.isForceUpdate + // Handle string "true"/"false" from FormData - if (typeof value === 'string') { - return value.toLowerCase() === 'true' + if (typeof rawValue === 'string') { + return rawValue.toLowerCase() === 'true' } - return value === true + // Handle undefined/null - default to false + if (rawValue === undefined || rawValue === null) { + return false + } + // Handle actual boolean value + return rawValue === true }) @IsBoolean() isForceUpdate?: boolean