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: misskey detection could fail due to an early axios throw #1614

Merged
merged 4 commits into from
Mar 7, 2023

Conversation

mogita
Copy link
Contributor

@mogita mogita commented Mar 7, 2023

Hi h3poteto,

Thank you for maintaining such a wonderful library. I'm building a tool based on megalodon.

Meanwhile I found that detection on misskey.io failed with the 5.4.0 version. Without the try catch block, Axios would throw on attempting to visit https://misskey.io/api/v1/instance in the first place. So I added the try catch back with a little more explicitness.

Changes (all tests passed):

  • detector handles sns name detection more thoroughly
  • detector explicitly returns null if no known platform can be detected

Please let me know how you think and if there's anything that I missed or have done incorrectly. Thanks!

@mogita mogita requested a review from h3poteto as a code owner March 7, 2023 09:22
@h3poteto
Copy link
Owner

h3poteto commented Mar 7, 2023

I'm wondering why the master test passed.

describe('misskey', () => {
const url = 'https://misskey.io'
it('should be misskey', async () => {
const misskey = await detector(url)
expect(misskey).toEqual('misskey')
})
})

Copy link
Owner

@h3poteto h3poteto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@h3poteto h3poteto merged commit 75af240 into h3poteto:master Mar 7, 2023
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 this pull request may close these issues.

2 participants