asnunes / notion-page-to-html

NodeJS tool to convert public Notion pages to HTML from page ID
MIT License
163 stars 45 forks source link

fix: 403 error in cover pages #16

Closed Soneji closed 3 years ago

Soneji commented 3 years ago

this is the best monkeypatch i can come up with right now to ensure the app doesnt crash if it recieves a URL like that. Up to you if you want to merge it or come up with a better solution :)

asnunes commented 3 years ago

Thank you for your PR @Soneji! I prefer to keep throwing an error in this situation because 403 should not happen by default. But the error like "unexpected token on a JSON" was very undescriptive, so your 403 status code verification is very useful. Therefore I kept it and just replaced your console.log with a new ForbiddenError class.

I will release another update to authenticate correctly on cover image requests to prevent the 403 error from keep happening.

Soneji commented 3 years ago

Ah I'm glad the PR was of some help, thanks for fixing this! :)