Don't look at developer docs when getting released release notes
authorMagnus Hagander <magnus@hagander.net>
Thu, 4 May 2023 12:06:23 +0000 (14:06 +0200)
committerMagnus Hagander <magnus@hagander.net>
Thu, 4 May 2023 12:06:23 +0000 (14:06 +0200)
This could cause a crash when the devel version of the docs had a
placeholder entry for a major version that had not yet been released.

pgweb/docs/views.py

index fbb4a352a4620ee3895d060991e7f03faf9974a3..b37895edbce2bcd9f2a7319d0a52cb9faac2f4e4 100644 (file)
@@ -348,7 +348,7 @@ def release_notes(request, version):
 
     # If we have an exact match for our major version, get that one. If not, get the release
     # notes from the highest available version.
-    release_notes = exec_to_dict("SELECT content FROM docs WHERE file=%(filename)s ORDER BY version=%(major_version)s DESC, version DESC LIMIT 1", {
+    release_notes = exec_to_dict("SELECT content FROM docs WHERE file=%(filename)s AND version > 0 ORDER BY version=%(major_version)s DESC, version DESC LIMIT 1", {
         'filename': version_file,
         'major_version': major_version,
     })