From 1138d51dc437fbc5cc0d45ae18c6902b259f26b1 Mon Sep 17 00:00:00 2001 From: Noelle Leigh Date: Sat, 6 Nov 2021 13:15:06 -0400 Subject: [PATCH] jobs.resubmit_GET: only add suffix to 1 line notes The number of considerations required to safely truncate a block of multiline Markdown without mangling the formatting is quite large, so instead we settle for appending "(resubmitted)" only to notes which have a single line. --- buildsrht/blueprints/jobs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/buildsrht/blueprints/jobs.py b/buildsrht/blueprints/jobs.py index 0f267ea..4f48b3e 100644 --- a/buildsrht/blueprints/jobs.py +++ b/buildsrht/blueprints/jobs.py @@ -205,7 +205,11 @@ def resubmit_GET(job_id): if not job: abort(404) session["manifest"] = job.manifest - session["note"] = addsuffix(job.note, "(resubmitted)") + if isinstance(job.note, str) and len(job.note.splitlines()) == 1: + note = addsuffix(job.note, "(resubmitted)") + else: + note = job.note + session["note"] = note return redirect("/submit") @jobs.route("/submit", methods=["POST"]) -- 2.38.5