Skip to content
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

InputStreams for attachments are not closed #308

Closed
Moire9 opened this issue Jun 6, 2021 · 0 comments · Fixed by #309
Closed

InputStreams for attachments are not closed #308

Moire9 opened this issue Jun 6, 2021 · 0 comments · Fixed by #309

Comments

@Moire9
Copy link
Contributor

Moire9 commented Jun 6, 2021

When you add attachments with a MessageCreateBuilder, you give it an InputStream that it reads the data from. However, this stream is never closed, which is very bad.

Fix: in dev.kord.rest.request.Request, replace line 86 with files[0].second.use { it.copyTo(outputStream()) }, and replace lines 88-90 with append("file$index", pair.first) { pair.second.use { it.copyTo(outputStream()) } }

Should look like this:
image
Excuse the lack of input highlighting, IntelliJ was having issues.

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 a pull request may close this issue.

1 participant