From 111841ad3482c1d41c6f117a3e70676e06d4ca61 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 10 Oct 2018 07:53:20 +0000 Subject: [PATCH] common api: take the combination of the subject and content for length limit enforcement closes #315 --- lib/pleroma/web/common_api/common_api.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index d4a973e36..f8fef219f 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -83,7 +83,6 @@ def post(user, %{"status" => status} = data) do visibility = get_visibility(data) with status <- String.trim(status), - length when length in 1..@limit <- String.length(status), attachments <- attachments_from_ids(data["media_ids"]), mentions <- Formatter.parse_mentions(status), inReplyTo <- get_replied_to_activity(data["in_reply_to_status_id"]), @@ -100,6 +99,8 @@ def post(user, %{"status" => status} = data) do ), context <- make_context(inReplyTo), cw <- data["spoiler_text"], + full_payload <- String.trim(status <> (data["spoiler_text"] || "")), + length when length in 1..@limit <- String.length(full_payload), object <- make_note_data( user.ap_id,