Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use correct host in URL construction #17338

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions warehouse/observations/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,25 @@ def report_observation_to_helpscout(task, request: Request, model_id: UUID) -> N
# Maybe need a mapping of ObservationType and the name we want to use.
target_name = model.related.name

warehouse_domain = request.registry.settings.get("warehouse.domain")

# Add new Conversation to HelpScout for tracking purposes
convo_text = dedent(
f"""
Kind: {model.kind}
Summary: {model.summary}
Model Name: {model.__class__.__name__}

Project URL: {request.route_url('packaging.project', name=target_name)}
Project URL: {request.route_url(
'packaging.project', name=target_name, _host=warehouse_domain
)}
"""
)
for owner in model.related.owners:
username = owner.username
owner_url = request.route_url("admin.user.detail", username=username)
owner_url = request.route_url(
"admin.user.detail", username=username, _host=warehouse_domain
)
convo_text += f"Owner: {username}\n"
convo_text += f"Owner URL: {owner_url}\n"

Expand All @@ -102,7 +108,7 @@ def report_observation_to_helpscout(task, request: Request, model_id: UUID) -> N
Malware Reports URL: {request.route_url(
"admin.malware_reports.project.list",
project_name=target_name,
_host=request.registry.settings.get("warehouse.domain"),
_host=warehouse_domain,
)}
"""
)
Expand Down