You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because mime.TypeByExtension(ext) identifies .ts files like that. I hacked it by adding this just to solve my direct use case in detectMimeType:
Im not sure what a proper solution should be, just thought I'd let you know
Here is detectMimeType with this little hack.
// detectMimeType tries to determine the MIME type of a file
func detectMimeType(path string) string {
// First try by extension
ext := filepath.Ext(path)
if ext != "" {
mimeType := mime.TypeByExtension(ext)
if mimeType != "" && mimeType != "video/mp2t" {
return mimeType
}
}
// If that fails, try to read a bit of the file
file, err := os.Open(path)
if err != nil {
return "application/octet-stream" // Default
}
defer file.Close()
// Read first 512 bytes to detect content type
buffer := make([]byte, 512)
n, err := file.Read(buffer)
if err != nil {
return "application/octet-stream" // Default
}
// Use http.DetectContentType
return http.DetectContentType(buffer[:n])
}
The text was updated successfully, but these errors were encountered:
I have been using the mcp server pretty extensively to power coding with Claude.
One issue I have seen claude run into a lot is that .ts files get identified as video/mp2t.
For example here from the logs:
This is because mime.TypeByExtension(ext) identifies .ts files like that. I hacked it by adding this just to solve my direct use case in detectMimeType:
Im not sure what a proper solution should be, just thought I'd let you know
Here is detectMimeType with this little hack.
The text was updated successfully, but these errors were encountered: