diff options
| author | Aiden Cline <[email protected]> | 2026-01-19 14:49:51 -0600 |
|---|---|---|
| committer | Aiden Cline <[email protected]> | 2026-01-19 14:49:51 -0600 |
| commit | 769c97af086e5edf0efb431e902eceb54dc668cb (patch) | |
| tree | c49e9b649127f09f49765808930d12aed4f718ce | |
| parent | e29120317f8820a86054bb20e8982f0947fa03cd (diff) | |
| download | opencode-769c97af086e5edf0efb431e902eceb54dc668cb.tar.gz opencode-769c97af086e5edf0efb431e902eceb54dc668cb.zip | |
chore: rm double conditional
| -rw-r--r-- | packages/opencode/src/file/ripgrep.ts | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/packages/opencode/src/file/ripgrep.ts b/packages/opencode/src/file/ripgrep.ts index 834cbee1e..0d1817356 100644 --- a/packages/opencode/src/file/ripgrep.ts +++ b/packages/opencode/src/file/ripgrep.ts @@ -162,34 +162,32 @@ export namespace Ripgrep { }) } if (config.extension === "zip") { - if (config.extension === "zip") { - const zipFileReader = new ZipReader(new BlobReader(new Blob([await Bun.file(archivePath).arrayBuffer()]))) - const entries = await zipFileReader.getEntries() - let rgEntry: any - for (const entry of entries) { - if (entry.filename.endsWith("rg.exe")) { - rgEntry = entry - break - } + const zipFileReader = new ZipReader(new BlobReader(new Blob([await Bun.file(archivePath).arrayBuffer()]))) + const entries = await zipFileReader.getEntries() + let rgEntry: any + for (const entry of entries) { + if (entry.filename.endsWith("rg.exe")) { + rgEntry = entry + break } + } - if (!rgEntry) { - throw new ExtractionFailedError({ - filepath: archivePath, - stderr: "rg.exe not found in zip archive", - }) - } + if (!rgEntry) { + throw new ExtractionFailedError({ + filepath: archivePath, + stderr: "rg.exe not found in zip archive", + }) + } - const rgBlob = await rgEntry.getData(new BlobWriter()) - if (!rgBlob) { - throw new ExtractionFailedError({ - filepath: archivePath, - stderr: "Failed to extract rg.exe from zip archive", - }) - } - await Bun.write(filepath, await rgBlob.arrayBuffer()) - await zipFileReader.close() + const rgBlob = await rgEntry.getData(new BlobWriter()) + if (!rgBlob) { + throw new ExtractionFailedError({ + filepath: archivePath, + stderr: "Failed to extract rg.exe from zip archive", + }) } + await Bun.write(filepath, await rgBlob.arrayBuffer()) + await zipFileReader.close() } await fs.unlink(archivePath) if (!platformKey.endsWith("-win32")) await fs.chmod(filepath, 0o755) |
