feat: add MimeType detection to StatFile #10
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
basepeak-ai/workspace-provider!10
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/statfile-mimetype"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This improves experience with knowledge, as we don't have to pull a whole file from S3 just to detect the mimetype from the first few bytes.
Other options would require us to add extra subtools and touch too many other pieces of code, so this is the easiest to implement and clean solution.
@ -145,3 +152,4 @@return FileInfo{WorkspaceID: DirectoryProvider + "://" + d.dataHome,Name: stat.Name(),This returns
application/octet-streamwhen it fails to identify the mime type. I think we may want some logic to increase the read limit -- as per themimetypeREADME -- and try again when that happens.@ -145,3 +152,4 @@return FileInfo{WorkspaceID: DirectoryProvider + "://" + d.dataHome,Name: stat.Name(),Yeah.. I don't know how sophisticated we want to get here, as for the current use case this is good enough.
The mentioned office documents are included by extension on knowledge side, so we won't care about the mimetype.
But I agree, that we need to have some more sophisticated approach here if we want to be 100% sure.
@ -142,11 +143,19 @@ func (d *directoryProvider) StatFile(_ context.Context, s string) (FileInfo, errreturn FileInfo{}, errnit:
@ -145,3 +152,4 @@return FileInfo{WorkspaceID: DirectoryProvider + "://" + d.dataHome,Name: stat.Name(),That's fair enough!