Commit c67f1ca2 authored by Mikko Ahlroth's avatar Mikko Ahlroth

Convert pluses in profile path to spaces to fix usernames with spaces

parent 1f3a2698
......@@ -3,7 +3,7 @@ defmodule CodeStats.Mixfile do
def project do
[app: :code_stats,
version: "1.3.3",
version: "1.3.4",
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
......
......@@ -19,7 +19,9 @@ defmodule CodeStats.ProfileController do
end
def profile(conn, %{"username" => username}) do
case AuthUtils.get_user(username) do
fix_url_username(username)
|> AuthUtils.get_user()
|> case do
nil -> render_404(conn)
%User{} = user ->
......@@ -137,4 +139,10 @@ defmodule CodeStats.ProfileController do
ret -> ret
end
end
# Fix the username specified in the URL by converting plus characters to spaces.
# This is not done by Phoenix for some reason.
defp fix_url_username(username) do
String.replace(username, "+", " ")
end
end
......@@ -24,6 +24,14 @@
<h2>Changelog</h2>
<h3>1.3.4 – 2016-06-07 – Username path fix</h3>
<p>
<ul>
<li>Fixed spaces in usernames resulting in unreachable profile pages.</li>
</ul>
</p>
<h3>1.3.3 – 2016-06-07 – JetBrains</h3>
<p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment