diff options
| author | Joe Mou <dev@mou.fo> | 2026-01-26 15:36:23 -0500 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-01-27 11:27:01 -0500 |
| commit | dac0a13f247fa17667ac5983ec65df0756e0829f (patch) | |
| tree | ab20f634650f96e5f425d88803a97aaf90fa9620 /cgithub/src/scraper.ts | |
| parent | 744f42a2ae7968881e4d8f1ce0ec0d5209c8d7a4 (diff) | |
GitHub scraper test
Diffstat (limited to 'cgithub/src/scraper.ts')
| -rw-r--r-- | cgithub/src/scraper.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cgithub/src/scraper.ts b/cgithub/src/scraper.ts index 4ffdc43..4feda73 100644 --- a/cgithub/src/scraper.ts +++ b/cgithub/src/scraper.ts @@ -63,7 +63,7 @@ export interface GitHubRepo extends GitHubTree { export interface GitHubBlob extends GitHubCommon { language: string | null; - size: number; + size: number | null; content: string; rawContent: string; } @@ -210,10 +210,13 @@ export async function getGitHubBlob( const highlightedLines = blob.highlightedLines || []; const content = highlightedLines.map((line) => line.text || "").join("\n"); + // Calculate size from raw content if not provided + const size = blob.size ?? (rawContent.length > 0 ? Buffer.byteLength(rawContent, "utf8") : null); + return extractGitHub(payload, { content: content || rawContent, rawContent, language: blob.language || null, - size: blob.size, + size, }); } |
