mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
fix tag slug double encoding (derpibooru/philomena#203)
This commit is contained in:
parent
0f69ae6fcf
commit
54e775a6c6
3 changed files with 6 additions and 3 deletions
|
@ -47,8 +47,7 @@ defmodule Philomena.Slug do
|
||||||
|> String.replace(":", "-colon-")
|
|> String.replace(":", "-colon-")
|
||||||
|> String.replace(".", "-dot-")
|
|> String.replace(".", "-dot-")
|
||||||
|> String.replace("+", "-plus-")
|
|> String.replace("+", "-plus-")
|
||||||
|> URI.encode_www_form()
|
|> String.replace(" ", "+")
|
||||||
|> String.replace("%20", "+")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def slug(_string), do: ""
|
def slug(_string), do: ""
|
||||||
|
|
|
@ -10,7 +10,7 @@ span.tag.dropdown data-tag-category="#{@tag.category}" data-tag-id="#{@tag.id}"
|
||||||
span.tag__state.hidden title="Hidden"
|
span.tag__state.hidden title="Hidden"
|
||||||
| H
|
| H
|
||||||
|
|
||||||
a.tag__name< href=Routes.tag_path(@conn, :show, @tag) title="#{@tag.short_description}" = @tag.name
|
a.tag__name< href=pretty_tag_path(@tag) title="#{@tag.short_description}" = @tag.name
|
||||||
|
|
||||||
div.dropdown__content
|
div.dropdown__content
|
||||||
a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unwatch" href=Routes.tag_watch_path(@conn, :delete, @tag) Unwatch
|
a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unwatch" href=Routes.tag_watch_path(@conn, :delete, @tag) Unwatch
|
||||||
|
|
|
@ -20,6 +20,10 @@ defmodule PhilomenaWeb.TagView do
|
||||||
can?(conn, :alias, %Tag{})
|
can?(conn, :alias, %Tag{})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pretty_tag_path(%{slug: slug}) do
|
||||||
|
"/tags/" <> URI.encode(slug, &(&1 == ?+ or URI.char_unescaped?(&1)))
|
||||||
|
end
|
||||||
|
|
||||||
def tag_image(%{image: image}) do
|
def tag_image(%{image: image}) do
|
||||||
tag_url_root() <> "/" <> image
|
tag_url_root() <> "/" <> image
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue