Skip to content

Commit

Permalink
Fix crash in package_view_client when long desc is null
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jan 26, 2025
1 parent 23e9ad6 commit 24eacb1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/blueprints/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ def package_view_client(package: Package):

formspec_version = get_int_or_abort(request.args["formspec_version"])
include_images = is_yes(request.args.get("include_images", "true"))
html = render_markdown(data["long_description"])
page_url = package.get_url("packages.view", absolute=True)
data["long_description"] = html_to_minetest(html, page_url, formspec_version, include_images)
if data["long_description"] is not None:
html = render_markdown(data["long_description"])
data["long_description"] = html_to_minetest(html, page_url, formspec_version, include_images)

data["info_hypertext"] = package_info_as_hypertext(package, formspec_version)

Expand Down Expand Up @@ -150,7 +151,7 @@ def package_view_client_reviews(package: Package):
def package_hypertext(package):
formspec_version = get_int_or_abort(request.args["formspec_version"])
include_images = is_yes(request.args.get("include_images", "true"))
html = render_markdown(package.desc)
html = render_markdown(package.desc if package.desc else "")
page_url = package.get_url("packages.view", absolute=True)
return jsonify(html_to_minetest(html, page_url, formspec_version, include_images))

Expand Down

0 comments on commit 24eacb1

Please sign in to comment.