diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex
index 6cf8682b8..e8fc9c291 100644
--- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex
+++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex
@@ -347,7 +347,8 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
def update_profile(%{assigns: %{user: user}} = conn, params) do
params =
if bio = params["description"] do
- Map.put(params, "bio", bio)
+ bio_brs = Regex.replace(~r/\r?\n/,bio,"
")
+ Map.put(params, "bio", bio_brs)
else
params
end
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs
index 406dace1c..c239239d3 100644
--- a/test/web/twitter_api/twitter_api_controller_test.exs
+++ b/test/web/twitter_api/twitter_api_controller_test.exs
@@ -784,4 +784,20 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
assert status["id"] == activity.id
end
end
+
+ test "Convert newlines to
in bio", %{conn: conn} do
+ user = insert(:user)
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> post("/api/account/update_profile.json", %{
+ "description" => "Hello,\r\nWorld! I\n am a test."
+ })
+
+ user = Repo.get!(User, user.id)
+ assert user.bio == "Hello,
World! I
am a test."
+ end
+
+
end