mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-09-18 06:22:08 +09:00
Compare a preview's host to ours with the escapes resolved
Ruby leaves a percent-escape in URI#host, so "https://%77ww.example.com" read as a different host than the one Campfire answers on while a browser unescaped it straight back to us. A host that carries an escape, or a trailing dot, is now measured the way the browser will read it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0186eyzivcTn6wqjEE4Wnxdt
This commit is contained in:
@@ -19,10 +19,11 @@ class ActionText::Attachment::OpengraphEmbedTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test "drops a link and an image on this Campfire's own host" do
|
||||
test "drops a link and an image on this Campfire's own host, however it is spelled" do
|
||||
Current.set request: ActionDispatch::TestRequest.create("HTTP_HOST" => "once.campfire.test") do
|
||||
[ "https://once.campfire.test/rooms/1", "http://once.campfire.test/rooms/1",
|
||||
"https://ONCE.Campfire.Test/rooms/1" ].each do |value|
|
||||
"https://ONCE.Campfire.Test/rooms/1", "https://once.campfire.test./rooms/1",
|
||||
"https://%6fnce.campfire.test/rooms/1", "https://%77ww.example.com/x.png" ].each do |value|
|
||||
embed = embed_from href: value, url: value
|
||||
|
||||
assert_nil embed.href, "expected #{value.inspect} to be dropped as a link"
|
||||
|
||||
Reference in New Issue
Block a user