-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsupported Buffer file type on sending buffer containing js file #350
Comments
Why exactly are you checking if the document is a "valid file type" anyways? Since telegram allows any "file" to be sent via document this doesn't seem reasonable to me. |
It's because It's weird file type isn't detected. Maybe should provide a default content-type (application/octet-stream or text/plain) |
I have the same issue with MP3 not being detected. Could you add an option to explicitly specify the MIME type? |
backgroundIt is easier to have the library auto-detect the MIME type, thus abstracting all that from the user. But advanced users may want to handle that on their own. When using type auto-detection, we should throw an error if it fails. This avoids situations where bots send files to their users using a probably wrong type. suggested fix
|
Update:
|
In v0.30.0, the file type of a buffer, if not be detectable, defaults to NOTE: For now, this has to be manually activated using environment variable See the updated docs on sending files, particularly here. |
I'm using the current master git branch.
Expected Behavior
Send buffer containing the contents of a .js file
Actual Behavior
Unhandled rejection Error: EFATAL: Unsupported Buffer file type
telegram.js:249 seems to be the problem.
Steps to reproduce the Behavior
Send buffer containing plain text
The text was updated successfully, but these errors were encountered: