Skip to content

Commit

Permalink
Better handling for empty referer
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjaustin committed Jul 25, 2024
1 parent 660f203 commit 6131f43
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/feedback_reporters/support_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def custom_zoho_fields
# The Zoho field supports at most 255 characters. That _should_ be enough, but technically
# we support ludicrously long URLs because searches can do that. In those cases, just get the
# first 255 characters.
sanitized_url = referer ? referer[0..254] : "Unknown URL"
sanitized_url = referer.present? ? referer[0..254] : "Unknown URL"
{
"cf_archive_version" => site_revision.presence || "Unknown site revision",
"cf_rollout" => rollout.presence || "Unknown",
Expand Down
2 changes: 1 addition & 1 deletion spec/models/feedback_reporters/support_reporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
end

it "returns a hash containing a blank string for referer" do
expect(subject.report_attributes.dig("cf", "cf_url")).to eq("")
expect(subject.report_attributes.dig("cf", "cf_url")).to eq("Unknown URL")
end
end

Expand Down

0 comments on commit 6131f43

Please sign in to comment.