saper has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/90057


Change subject: Escape backslashes in image metadata
......................................................................

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
---
M includes/filerepo/file/LocalFile.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/57/90057/1

diff --git a/includes/filerepo/file/LocalFile.php 
b/includes/filerepo/file/LocalFile.php
index 627defd..0c34f3e 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -539,7 +539,7 @@
                                '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 @@
                                '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 @@
                                        '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() ),

-- 
To view, visit https://gerrit.wikimedia.org/r/90057
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife56cffe3df83ec1a7bd39cdc4a0489f23354494
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: saper <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to