boostorg / website-v2

New Boost website
https://boost.io
Boost Software License 1.0
8 stars 13 forks source link

Fall back to _x filename for beta release notes #1455

Closed GregKaleka closed 3 days ago

GregKaleka commented 3 days ago

Follow-up fix for #1171

It turns out the newest beta release notes have been named version_1_87_x.html instead of the expected version_1_87_0.html name. This PR creates a fallback strategy that first attempts the _0 filename, then tries _x if the former results in a 404 response.

Manual testing

I wasn't able to successfully test the S3 version of the function, since the beta release notes do not yet appear to be in S3.

For the GitHub version, I added a print statement for debug purposes to indicate we were hitting the fallback url with the _x filename suffix.


In [1]: v = Version.objects.last()

In [2]: v.slug
Out[2]: 'boost-1-87-0-beta1'

In [3]: from versions.releases import get_release_notes_for_version_github

In [4]: html = get_release_notes_for_version_github(v.pk)
normal url failed; trying fallback

In [5]: html[:100]
Out[5]: b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n    "http://www.w3.org/TR/xhtml1/DTD/xhtml1'