Skip to content

fix(parsers): fix md, pptx, html kb uploads#1209

Merged
waleedlatif1 merged 2 commits intostagingfrom
fix/kb
Aug 31, 2025
Merged

fix(parsers): fix md, pptx, html kb uploads#1209
waleedlatif1 merged 2 commits intostagingfrom
fix/kb

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

fix md, pptx, html kb uploads. we added the parsers for them, but needed to add some additional logic to ensure we accept any of their formats in the UI uploads

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Screen.Recording.2025-08-31.at.12.36.00.AM.mov

@vercel
Copy link

vercel bot commented Aug 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Building Building Preview Comment Aug 31, 2025 7:52am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 31, 2025 7:52am

@waleedlatif1 waleedlatif1 merged commit 43cb124 into staging Aug 31, 2025
3 of 4 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/kb branch August 31, 2025 07:52
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR fixes a bug where knowledge base uploads were rejecting MD, PPTX, and HTML files despite having backend parsers available for these formats. The solution centralizes file validation logic by creating a new validation module at /lib/uploads/validation.ts that maps file extensions to multiple MIME types to handle browser inconsistencies.

The changes extract hardcoded file type constants from two upload components (upload-modal.tsx and create-modal.tsx) and replace them with imports from the centralized validation module. The new validation system extends support to include 'ppt', 'pptx', 'html', and 'htm' extensions, with comprehensive MIME type mappings that account for various browser interpretations (e.g., MD files can be reported as 'text/markdown', 'text/x-markdown', 'text/plain', or 'application/markdown').

The validation module exports three key utilities: ACCEPTED_FILE_TYPES (flattened array of all supported MIME types), ACCEPTED_FILE_EXTENSIONS (array of file extensions with dot prefixes), and ACCEPT_ATTRIBUTE (combined string for HTML input accept attributes). This approach aligns with the codebase's pattern of using dedicated configuration files for component properties and ensures consistent file handling across all upload interfaces.

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it addresses a clear bug with a well-structured solution
  • Score reflects solid architectural approach of centralizing validation logic and comprehensive MIME type handling, though manual testing only slightly reduces confidence
  • Pay close attention to /lib/uploads/validation.ts to ensure all supported file types have appropriate MIME type mappings

Context used:

Context - When defining properties for components, use a dedicated config file (.ts) for configuration and keep rendered components in their respective component files. (link)

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

waleedlatif1 added a commit that referenced this pull request Sep 1, 2025
* fix md, pptx, html

* consolidate consts
waleedlatif1 added a commit that referenced this pull request Sep 2, 2025
* fix md, pptx, html

* consolidate consts
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
* fix md, pptx, html

* consolidate consts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant