Skip to content

Commit

Permalink
Fix octokit types (elastic#211643)
Browse files Browse the repository at this point in the history
Related to elastic#211450
  • Loading branch information
jbudz authored Feb 18, 2025
1 parent 05ae2b1 commit 8a55fdf
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ export async function downloadTelemetryTemplate({ githubToken }: { githubToken:
},
});

if (Array.isArray(file.data)) {
if (!Array.isArray(file.data) && file.data.type === 'file') {
return JSON.parse(Buffer.from(file.data.content!, 'base64').toString()) as {
index_patterns: string[];
mappings: {
properties: Record<string, any>;
};
settings: Record<string, any>;
};
} else {
throw new Error('Expected single response, got array');
}

return JSON.parse(Buffer.from(file.data.content!, 'base64').toString()) as {
index_patterns: string[];
mappings: {
properties: Record<string, any>;
};
settings: Record<string, any>;
};
}

0 comments on commit 8a55fdf

Please sign in to comment.