https://bugzilla.wikimedia.org/show_bug.cgi?id=52017

       Web browser: ---
            Bug ID: 52017
           Summary: Error uploading file where it has backslahes in file
                    metadata using PostgreSQL 9.1.9
           Product: MediaWiki
           Version: 1.20.0
          Hardware: All
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: File management
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---

Created attachment 12955
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=12955&action=edit
zip-file which contains the patch-file and image with backslashes in its
metadata

Hello,


I have installed mediawiki 1.20.0 on a RHEL system with a PostgreSQL 9.1.9
database.

When i try to upload a file which contains backslashes in its metadata i get
the following error:

<--- snip --->
A database query syntax error has occurred. This may indicate a bug in the
software. The last attempted database query was:

INSERT INTO "image"
(img_name,img_size,img_width,img_height,img_bits,img_media_type,img_major_mime,img_minor_mime,img_timestamp,img_description,img_user,img_user_text,img_metadata,img_sha1)
VALUES ('PO_02.png','21440','825','704','8','BITMAP','image','png','2013-07-25
08:59:43
GMT','','92','<username>','a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:16:"truecolour-alpha";s:8:"metadata";a:5:{s:11:"XResolution";s:8:"3780/100";s:11:"YResolution";s:8:"3780/100";s:14:"ResolutionUnit";i:3;s:16:"ImageDescription";a:2:{s:9:"x-default";s:127:"[SCM]actwin,18,18,19,19;Poedit
: C:\Documents and Settings\<username>\Desktop\buddypress-de_DE.po poedit
05.04.2012 ,
20:47:26";s:5:"_type";s:4:"lang";}s:15:"_MW_PNG_VERSION";i:1;}}','14iv15dq7i5djf63k6w5fl3hjqzki4v')

from within function „LocalFile::recordUpload2“. Database returned error
„22P02: ERROR: invalid input syntax for type bytea LINE 1: ...013-07-25
08:59:43 GMT','','92','<username>','a:6:{s:10... ^ “.
<--- snap --->

This is caused by PostgreSQL because the field metadata in the table image is
of the type "bytea" and the backslashes in the SQL-statement aren't encoded. 

See a possible solution in the attached patch-file. This patch-file is build
for the file includes/filerepo/file/LocalFile.php.

For testing I have attached a file which caused the error.


Yours faithfully,



Erich Lerch

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to