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

fix: malformed debug ID #2733

Merged
merged 1 commit into from Jan 12, 2024

Conversation

EvanHahn
Copy link
Contributor

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[x] Bug fix
[ ] New feature
[ ] Other, please explain:

What changes did you make? (Give an overview)

You can see debug messages from WebTorrent with the DEBUG environment variable. For example, in this repository:

DEBUG=webtorrent npm test

Debug messages should contain the first 7 characters of the peer ID. However, they currently look like this:

webtorrent [02undef] listening +7ms

"02undef" seems wrong. After this change, the debug ID looks correct:

webtorrent [2d57573] listening +7ms

This happened because peerId is a string but was mistakenly being treated like a buffer.

Which issue (if any) does this pull request address?

No GitHub issues I'm aware of.

Is there anything you'd like reviewers to focus on?

No.

You can see debug messages from WebTorrent with the `DEBUG` environment
variable. For example, in this repository:

    DEBUG=webtorrent npm test

Debug messages should contain the first 7 characters of the peer ID.
However, they currently look like this:

    webtorrent [02undef] listening +7ms

"02undef" seems wrong. After this change, the debug ID looks correct:

    webtorrent [2d57573] listening +7ms

This happened because `peerId` is a string but was mistakenly being
treated like a buffer.
Copy link

welcome bot commented Jan 12, 2024

🙌 Thanks for opening this pull request! You're awesome.

@ThaUnknown
Copy link
Member

right, in v1 this did buffer.toString().toString() which when I was rewriting in v2 i assumed to be buffer.toString() when it was actually a string, good catch

@ThaUnknown ThaUnknown enabled auto-merge (squash) January 12, 2024 17:35
@ThaUnknown ThaUnknown merged commit 2453316 into webtorrent:master Jan 12, 2024
6 checks passed
Copy link

welcome bot commented Jan 12, 2024

🎉 Congrats on getting your first pull request landed!

webtorrent-bot pushed a commit that referenced this pull request Jan 12, 2024
## [2.1.33](v2.1.32...v2.1.33) (2024-01-12)

### Bug Fixes

* malformed debug ID ([#2733](#2733)) ([2453316](2453316))
@webtorrent-bot
Copy link
Collaborator

🎉 This PR is included in version 2.1.33 🎉

The release is available on:

Your semantic-release bot 📦🚀

@EvanHahn EvanHahn deleted the fix-malformed-debug-id branch January 12, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants