Skip to content

Commit

Permalink
fix(parser): resolve issue with with posts ending in backslashes caus…
Browse files Browse the repository at this point in the history
…ing parser to fail
  • Loading branch information
akinsey committed Nov 22, 2024
1 parent 6e48d6d commit 19445ab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/epochtalk_server_web/json/post_json.ex
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ defmodule EpochtalkServerWeb.Controllers.PostJSON do
defp format_proxy_post_data_for_by_thread(post) do
body = String.replace(Map.get(post, :body) || Map.get(post, :body_html), "'", "\'")

# add space to end if the last character is a backslash (fix for parser)
body_len = String.length(body)
last_char = String.slice(body, body_len - 1..body_len)
body = if last_char == "\\", do: body <> " ", else: body

parsed_body = EpochtalkServer.BBCParser.parse(body)

signature =
Expand Down

0 comments on commit 19445ab

Please sign in to comment.