From: Erich Lerch Date: Tue, 15 Oct 2013 23:09:27 +0000 (+0200) Subject: Escape backslashes in image metadata X-Git-Tag: 1.31.0-rc.0~18506 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/voir.php?a=commitdiff_plain;h=1cb9da7a149166a5bbb8c07bf4a415882f716160;p=lhc%2Fweb%2Fwiklou.git Escape backslashes in image metadata Uploading a file with backslashes in the metadata causes database exception on PostgreSQL, because backslashes are sent to the 'bytea' datatype unencoded. Bug: 52017 Change-Id: Ife56cffe3df83ec1a7bd39cdc4a0489f23354494 --- diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 627defd3fc..0c34f3e4f7 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -539,7 +539,7 @@ class LocalFile extends File { 'img_media_type' => $this->media_type, 'img_major_mime' => $major, 'img_minor_mime' => $minor, - 'img_metadata' => $this->metadata, + 'img_metadata' => $dbw->encodeBlob($this->metadata), 'img_sha1' => $this->sha1, ), array( 'img_name' => $this->getName() ), @@ -1225,7 +1225,7 @@ class LocalFile extends File { 'img_description' => $comment, 'img_user' => $user->getId(), 'img_user_text' => $user->getName(), - 'img_metadata' => $this->metadata, + 'img_metadata' => $dbw->encodeBlob($this->metadata), 'img_sha1' => $this->sha1 ), __METHOD__, @@ -1276,7 +1276,7 @@ class LocalFile extends File { 'img_description' => $comment, 'img_user' => $user->getId(), 'img_user_text' => $user->getName(), - 'img_metadata' => $this->metadata, + 'img_metadata' => $dbw->encodeBlob($this->metadata), 'img_sha1' => $this->sha1 ), array( 'img_name' => $this->getName() ),