Avoid null characters in package descriptions
This commit is contained in:
parent
93eac06fd6
commit
ed5419866f
2 changed files with 14 additions and 2 deletions
|
|
@ -322,7 +322,12 @@ WHERE packages.id IN (
|
|||
(list->vector
|
||||
(map (match-lambda
|
||||
((locale . description)
|
||||
(list locale description)))
|
||||
(list locale
|
||||
;; \u0000 has appeared in package
|
||||
;; descriptions (#71968), so strip it
|
||||
;; out here to avoid PostgreSQL throwing
|
||||
;; an error
|
||||
(string-delete-null description))))
|
||||
package-description-data)))))
|
||||
package-metadata-list))))
|
||||
(with-time-logging "preparing package synopsis set ids"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
#:use-module (squee)
|
||||
#:use-module (guix-data-service database)
|
||||
#:use-module (guix-data-service utils)
|
||||
#:export (quote-string
|
||||
#:export (string-delete-null
|
||||
quote-string
|
||||
value->quoted-string-or-null
|
||||
non-empty-string-or-false
|
||||
parse-postgresql-array-string
|
||||
|
|
@ -39,6 +40,12 @@
|
|||
insert-and-return-id
|
||||
prepare-insert-and-return-id))
|
||||
|
||||
(define (char-null? c)
|
||||
(char=? c #\null))
|
||||
|
||||
(define (string-delete-null s)
|
||||
(string-delete char-null? s))
|
||||
|
||||
(define (quote-string s)
|
||||
(string-append "$STR$" s "$STR$"))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue