(userData: string)
| 102 | * which ship without a CA bundle on Windows. |
| 103 | */ |
| 104 | export function getCertifiBundle(userData: string): string | undefined { |
| 105 | const venvDir = getVenvDir(userData) |
| 106 | // Windows venv layout: Lib/site-packages/certifi/cacert.pem |
| 107 | const winPath = join(venvDir, 'Lib', 'site-packages', 'certifi', 'cacert.pem') |
| 108 | if (existsSync(winPath)) return winPath |
| 109 | // Linux/macOS venv layout: lib/pythonX.Y/site-packages/certifi/cacert.pem |
| 110 | const libDir = join(venvDir, 'lib') |
| 111 | if (existsSync(libDir)) { |
| 112 | try { |
| 113 | const { readdirSync } = require('fs') as typeof import('fs') |
| 114 | for (const entry of readdirSync(libDir)) { |
| 115 | const candidate = join(libDir, entry, 'site-packages', 'certifi', 'cacert.pem') |
| 116 | if (existsSync(candidate)) return candidate |
| 117 | } |
| 118 | } catch { /* ignore */ } |
| 119 | } |
| 120 | return undefined |
| 121 | } |
| 122 | |
| 123 | export function ensureSslPatch(userData: string): void { |
| 124 | if (process.platform !== 'win32') return |
nothing calls this directly
no test coverage detected