mirror of
https://github.com/boostorg/website-v2.git
synced 2026-01-19 04:42:17 +00:00
Strip querystring from report cover image url (#1635)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from urllib.parse import urlparse, urlunparse
|
||||
|
||||
from django import template
|
||||
from django.template.defaultfilters import stringfilter
|
||||
import re
|
||||
@@ -73,3 +75,13 @@ def url_target_blank(value, arg):
|
||||
Use after urlize to add target="_blank" and add classes.
|
||||
"""
|
||||
return value.replace("<a ", f'<a target="_blank" class="{arg}" ')
|
||||
|
||||
|
||||
@register.filter
|
||||
def strip_query_string(url):
|
||||
"""Remove query string from URL while preserving the path and other components."""
|
||||
if not url:
|
||||
return url
|
||||
parsed = urlparse(url)
|
||||
clean = parsed._replace(query="", fragment="")
|
||||
return urlunparse(clean)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends "admin/library_report_base.html" %}
|
||||
{% load humanize avatar_tags %}
|
||||
{% load humanize avatar_tags text_helpers %}
|
||||
{% load static %}
|
||||
{% block css %}
|
||||
{{ block.super }}
|
||||
@@ -93,7 +93,7 @@ body {
|
||||
{% if version.release_report_cover_image and version.release_report_cover_image.url %}
|
||||
<img
|
||||
class="max-h-[60%]"
|
||||
src="{{ version.release_report_cover_image.url }}"
|
||||
src="{{ version.release_report_cover_image.url|strip_query_string }}"
|
||||
alt="release report cover image"
|
||||
>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user