hodgesmr / mastodon_digest

A Python script that aggregates recent popular posts from your Mastodon timeline
BSD 3-Clause "New" or "Revised" License
439 stars 58 forks source link

Strip terminal slash from mastodon_base_url #7

Closed daeh closed 1 year ago

daeh commented 1 year ago

Amazing work on this. When I followed the setup instructions, the url I copied from my browser into .env came as https://mastodon.online/. The terminal slash in the MASTODON_BASE_URL variable led all of the urls returned by get_home_url() to be invalid. This PR adds minimal string sanitation to strip terminal slashes from the mastodon_base_url variable.

hodgesmr commented 1 year ago

Thanks for this. It may be best to move all the url building away from strings and to urlparse and urlunparse. Accepting this fix, and tracking the future work in #8.

daeh commented 1 year ago

++ Makes total sense. I started off using urlparse but didn't want to do much refactoring without having a blueprint of the roadmap. So I just went with the simplest possible solution for this single case.