jazzband / django-newsletter

An email newsletter application for the Django web application framework, including an extended admin interface, web (un)subscription, dynamic e-mail templates, an archive and HTML email support.
GNU Affero General Public License v3.0
846 stars 204 forks source link

Confirmation url in subscribe.html doubles slash #316

Closed FoliniC closed 4 years ago

FoliniC commented 4 years ago

In ..\templates\newsletter\message\\subscribe.html url is contructed with {{ domain }}{{ url }} domain ends with a slash and url starts also with slash.

When user clicks on it, it fails opening the right page. I modified ...\newsletter\models.py removing first char.

    def subscribe_activate_url(self):
        return reverse('newsletter_update_activate', kwargs={
            'newsletter_slug': self.newsletter.slug,
            'email': self.email,
            'action': 'subscribe',
            'activation_code': self.activation_code
        })[1:]

Same behavior on unsubscribe_activate_url

woodz- commented 4 years ago

Could it be that your server makes use of url rewriting? Would you be able to check this? Generally multiple forward slashes in urls are not a problem, they just imply an empty URI segment. See this sample: https://github.com///dokterbob/django-newsletter/issues//316

FoliniC commented 4 years ago

I discovered that absolute part of url came from newsletter configuration. Having my site hosted on AWS EC2 it can change host name. I managed to dinamically get the base url and I modifiied templates accordingly.

Thanks anyway!