Skip to content

Commit 9f5edc1

Browse files
committed
Etag matching fixes
1 parent 4a0477e commit 9f5edc1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎lib/plug/static.ex‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ defmodule Plug.Static do
306306
defp if_range_matches?(conn) do
307307
case {get_req_header(conn, "if-range"), get_resp_header(conn, "etag")} do
308308
{[], _} -> true
309-
{[etag], [etag]} -> not String.starts_with?(etag, "W/")
309+
{[etag], [etag]} -> not match?("W/" <> _, etag)
310310
_ -> false
311311
end
312312
end
@@ -419,8 +419,8 @@ defmodule Plug.Static do
419419
opaque_tag = strip_weak(etag)
420420

421421
Enum.any?(if_none_match, fn value ->
422-
value == etag or
423-
Enum.any?(Plug.Conn.Utils.list(value), &(&1 == "*" or strip_weak(&1) == opaque_tag))
422+
value == etag or value == "*" or
423+
Enum.any?(Plug.Conn.Utils.list(value), &(strip_weak(&1) == opaque_tag))
424424
end)
425425
end
426426

0 commit comments

Comments
 (0)