fix: remove unsafe link generation
This commit is contained in:
@@ -445,13 +445,6 @@ class AdoptionNotice(models.Model):
|
||||
distance = geo.calculate_distance_between_coordinates(self.position, position)
|
||||
return distance < max_distance
|
||||
|
||||
@property
|
||||
def link_to_more_information(self):
|
||||
from urllib.parse import urlparse
|
||||
|
||||
domain = urlparse(self.further_information).netloc
|
||||
return f"<a href='{self.further_information}'>{domain}</a>"
|
||||
|
||||
@property
|
||||
def is_active(self):
|
||||
if not hasattr(self, 'adoptionnoticestatus'):
|
||||
|
@@ -9,7 +9,11 @@
|
||||
<div class="card-content">
|
||||
<i>{% translate 'Zuletzt geprüft:' %} {{ adoption_notice.last_checked_hr }}</i>
|
||||
{% if adoption_notice.further_information %}
|
||||
<p>{% translate "Externe Quelle" %}: {{ adoption_notice.link_to_more_information | safe }}</p>
|
||||
<p>{% translate "Externe Quelle" %}:
|
||||
<a href="{{ adoption_notice.further_information }}" target="_blank">
|
||||
{{ adoption_notice.further_information | domain}}
|
||||
</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="card-footer">
|
||||
<div class="card-footer-item">
|
||||
|
Reference in New Issue
Block a user