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
|
(list->vector
|
||||||
(map (match-lambda
|
(map (match-lambda
|
||||||
((locale . description)
|
((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-description-data)))))
|
||||||
package-metadata-list))))
|
package-metadata-list))))
|
||||||
(with-time-logging "preparing package synopsis set ids"
|
(with-time-logging "preparing package synopsis set ids"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
#:use-module (squee)
|
#:use-module (squee)
|
||||||
#:use-module (guix-data-service database)
|
#:use-module (guix-data-service database)
|
||||||
#:use-module (guix-data-service utils)
|
#:use-module (guix-data-service utils)
|
||||||
#:export (quote-string
|
#:export (string-delete-null
|
||||||
|
quote-string
|
||||||
value->quoted-string-or-null
|
value->quoted-string-or-null
|
||||||
non-empty-string-or-false
|
non-empty-string-or-false
|
||||||
parse-postgresql-array-string
|
parse-postgresql-array-string
|
||||||
|
|
@ -39,6 +40,12 @@
|
||||||
insert-and-return-id
|
insert-and-return-id
|
||||||
prepare-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)
|
(define (quote-string s)
|
||||||
(string-append "$STR$" s "$STR$"))
|
(string-append "$STR$" s "$STR$"))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue