Merge pull request #348 from YunoHost/fix-text-error-formatting

replace backslash n with <br>
This commit is contained in:
Alexandre Aubin 2021-04-10 14:47:44 +02:00 committed by GitHub
commit 3f3fd2585f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,7 +59,7 @@ export async function handleError (request, response, errorData) {
let errorCode = response.status in errors ? response.status : undefined let errorCode = response.status in errors ? response.status : undefined
if (typeof errorData === 'string') { if (typeof errorData === 'string') {
// FIXME API: Patching errors that are plain text or html. // FIXME API: Patching errors that are plain text or html.
errorData = { error: errorData } errorData = { error: errorData.replace('\n', '<br>') }
} }
if ('log_ref' in errorData) { if ('log_ref' in errorData) {
// Define a special error so it won't get caught as a `APIBadRequestError`. // Define a special error so it won't get caught as a `APIBadRequestError`.