Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
fix: review round 3 of #81, word a refused reading as such, not as bad UTF-8
Guido Boyke69a2140f248a
diff --git a/config/locales/services.de.yml b/config/locales/services.de.ymlindex 129b17d..7ea607a 100644--- a/config/locales/services.de.yml+++ b/config/locales/services.de.yml@@ -174,7 +174,7 @@ de:post_comment:format_not_string: "Bitte geben Sie das Format (post[format]) als Text an: html oder plain."format_unknown: "Das Format (post[format]) muss html oder plain sein."- body_invalid_utf8: "Der Kommentar (post[body]) ist kein gültiges UTF-8."+ body_invalid_utf8: "Der Kommentar (post[body]) lässt sich nicht als UTF-8 lesen."body_nul: "Ein Kommentar im Format plain (post[body]) darf keine NUL-Bytes enthalten."body_empty: "Bitte geben Sie einen Kommentartext (post[body]) an."default_smart_folder:diff --git a/config/locales/services.en.yml b/config/locales/services.en.ymlindex 8df7416..f2c4ee3 100644--- a/config/locales/services.en.yml+++ b/config/locales/services.en.yml@@ -174,7 +174,7 @@ en:post_comment:format_not_string: "Give the format (post[format]) as text: html or plain."format_unknown: "The format (post[format]) must be html or plain."- body_invalid_utf8: "The comment (post[body]) is not valid UTF-8."+ body_invalid_utf8: "The comment (post[body]) cannot be read as UTF-8."body_nul: "A plain comment (post[body]) must not contain NUL bytes."body_empty: "The comment (post[body]) has no text."default_smart_folder:diff --git a/spec/requests/api/v1/post_comment_format_spec.rb b/spec/requests/api/v1/post_comment_format_spec.rbindex ac82be3..01f8fb1 100644--- a/spec/requests/api/v1/post_comment_format_spec.rb+++ b/spec/requests/api/v1/post_comment_format_spec.rb@@ -307,6 +307,16 @@ RSpec.describe 'API V1 comment format', :ci_guard, type: :request doexpect(body.dig('data', 'body_html')).to eq("<p>#{a_umlaut_b}<br><b></p>")end+ # 0x81 has no character in Windows-1252: the part cannot be transcoded. The+ # client declared no UTF-8, so the text names what failed, the reading.+ it 'refuses a plain part whose charset does not transcode, writing nothing' do+ expect { comment_multipart('format' => [nil, 'plain'], 'body' => ['text/plain; charset=windows-1252', "a#{0x81.chr}b"]) }+ .not_to(change { posts_count })+ expect(response).to have_http_status(:unprocessable_content)+ expect(body).to eq(refusal(:body_invalid_utf8))+ expect(body['errors']).to eq(['The comment (post[body]) cannot be read as UTF-8.'])+ end+it 'refuses a plain part declared binary that holds no UTF-8, writing nothing' doexpect { comment_multipart('format' => [nil, 'plain'], 'body' => ['text/plain; charset=binary', "a#{0xFF.chr}b"]) }.not_to(change { posts_count })