Skip to content

Commit

Permalink
Merge pull request #302 from kapt-labs/incorrect-urls-for-files-in-em…
Browse files Browse the repository at this point in the history
…ails

FIX: incorrect urls for files in emails
  • Loading branch information
barseghyanartur committed Dec 15, 2022
2 parents e365bf5 + fb8e7be commit 7f8c23f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/fobi/contrib/plugins/form_handlers/mail/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def run(
value
and isinstance(value, string_types)
and value.startswith(settings.MEDIA_URL)
and not value.startswith("http")
):
cleaned_data[key] = "{base_url}{value}".format(
base_url=base_url, value=value
Expand Down
6 changes: 4 additions & 2 deletions src/fobi/contrib/plugins/form_handlers/mail/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ def get_rendered_data(
rendered_data = []
for key, value in cleaned_data.items():
if value:
if isinstance(value, string_types) and value.startswith(
settings.MEDIA_URL
if (
isinstance(value, string_types)
and value.startswith(settings.MEDIA_URL)
and not value.startswith("http")
):
cleaned_data[key] = "{base_url}{value}".format(
base_url=base_url, value=value
Expand Down
1 change: 1 addition & 0 deletions src/fobi/contrib/plugins/form_handlers/mail_sender/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def run(
value
and isinstance(value, string_types)
and value.startswith(settings.MEDIA_URL)
and not value.startswith("http")
):
cleaned_data[key] = "{base_url}{value}".format(
base_url=base_url, value=value
Expand Down
6 changes: 4 additions & 2 deletions src/fobi/contrib/plugins/form_handlers/mail_sender/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ def get_rendered_data(
rendered_data = []
for key, value in cleaned_data.items():
if value:
if isinstance(value, string_types) and value.startswith(
settings.MEDIA_URL
if (
isinstance(value, string_types)
and value.startswith(settings.MEDIA_URL)
and not value.startswith("http")
):
cleaned_data[key] = "{base_url}{value}".format(
base_url=base_url, value=value
Expand Down

0 comments on commit 7f8c23f

Please sign in to comment.