Skip to content

Commit

Permalink
fix: Avoid indexing large files
Browse files Browse the repository at this point in the history
  • Loading branch information
baumandm committed Aug 29, 2024
1 parent 0ec611f commit 13b2205
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/backend/src/lib/backends/github.sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,12 @@ const syncFiles = async (
};

// Include the contents of text-based files
if (INDEXABLE_MIME_TYPES.has(file.mimeType) || file.mimeType.startsWith('text/')) {
if (
INDEXABLE_MIME_TYPES.has(file.mimeType) ||
(file.mimeType.startsWith('text/') &&
// Ensure the file is less than 1MB
file.size < 1024 * 1024)
) {
file.contents = contents?.toString('utf8');
}

Expand Down

0 comments on commit 13b2205

Please sign in to comment.