Project

General

Profile

Bug #103713

Les logs crash quand on log un caractère NUL - DataError: unsupported Unicode escape sequence

Added by Sentry Io about 1 month ago. Updated about 1 month ago.

Status:
Solution déployée
Priority:
Normal
Target version:
-
Start date:
20 March 2025
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

https://sentry.entrouvert.org/entrouvert/publik/issues/137696/

On reproduit avec ResourceLog.objects.create(levelno=1, extra='\x00\x00').extra

UntranslatableCharacter: unsupported Unicode escape sequence
LINE 1: ...is.grandlyon.fr/grc-rest-pro/1.0/creer (=> 200)', '{"request...
                                                             ^
DETAIL:  \u0000 cannot be converted to text.
CONTEXT:  JSON data, line 1: ...ent-Type: application/octet-stream\r\n\r\nV\u0000...

  File "django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)

DataError: unsupported Unicode escape sequence
LINE 1: ...is.grandlyon.fr/grc-rest-pro/1.0/creer (=> 200)', '{"request...
                                                             ^
DETAIL:  \u0000 cannot be converted to text.
CONTEXT:  JSON data, line 1: ...ent-Type: application/octet-stream\r\n\r\nV\u0000...

(21 additional frame(s) were not displayed)
...
  File "django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)

Error occurred while processing request

Associated revisions

Revision 59116921 (diff)
Added by Gael Pasgrimaud (retour le 12 mai) about 1 month ago

base: escape NUL caracters in extra before sending value to postgres JSONB (#103713)

History

#1

Updated by Gael Pasgrimaud (retour le 12 mai) about 1 month ago

  • Project changed from Suivi des traces to Passerelle
#3

Updated by Robot Gitea about 1 month ago

  • Status changed from Nouveau to En cours
  • Assignee set to Gael Pasgrimaud (retour le 12 mai)

Gael Pasgrimaud (gpasgrimaud) a ouvert une pull request sur Gitea concernant cette demande :

#4

Updated by Robot Gitea about 1 month ago

  • Status changed from En cours to Solution proposée
#5

Updated by Robot Gitea about 1 month ago

  • Status changed from Solution proposée to Solution validée

Emmanuel Cazenave (ecazenave) a approuvé une pull request sur Gitea concernant cette demande :

#6

Updated by Robot Gitea about 1 month ago

  • Status changed from Solution validée to Résolu (à déployer)

Gael Pasgrimaud (gpasgrimaud) a mergé une pull request sur Gitea concernant cette demande :

#7

Updated by Transition automatique about 1 month ago

  • Status changed from Résolu (à déployer) to Solution déployée

Also available in: Atom PDF