mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-21 11:30:38 -07:00
Disallow unsafe returns. (#19767)
This commit is contained in:
committed by
GitHub
parent
09218572d0
commit
dfd7721e69
@@ -348,6 +348,7 @@ export class IdeClient {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const parsedJson = JSON.parse(textPart.text);
|
||||
if (parsedJson && typeof parsedJson.content === 'string') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return parsedJson.content;
|
||||
}
|
||||
if (parsedJson && parsedJson.content === null) {
|
||||
|
||||
@@ -123,6 +123,7 @@ export async function getConnectionConfigFromFile(
|
||||
`gemini-ide-server-${pid}.json`,
|
||||
);
|
||||
const portFileContents = await fs.promises.readFile(portFile, 'utf8');
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return JSON.parse(portFileContents);
|
||||
} catch (_) {
|
||||
// For newer extension versions, the file name matches the pattern
|
||||
@@ -167,6 +168,7 @@ export async function getConnectionConfigFromFile(
|
||||
}
|
||||
const parsedContents = fileContents.map((content) => {
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return JSON.parse(content);
|
||||
} catch (e) {
|
||||
logger.debug('Failed to parse JSON from config file: ', e);
|
||||
@@ -196,6 +198,7 @@ export async function getConnectionConfigFromFile(
|
||||
if (fileIndex !== -1) {
|
||||
logger.debug(`Selected IDE connection file: ${matchingFiles[fileIndex]}`);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return selected;
|
||||
}
|
||||
|
||||
@@ -213,6 +216,7 @@ export async function getConnectionConfigFromFile(
|
||||
`Selected IDE connection file (matched port from env): ${matchingFiles[fileIndex]}`,
|
||||
);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return selected;
|
||||
}
|
||||
}
|
||||
@@ -225,6 +229,7 @@ export async function getConnectionConfigFromFile(
|
||||
`Selected first valid IDE connection file: ${matchingFiles[fileIndex]}`,
|
||||
);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return selected;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user