Last modified: 2013-10-15 23:29:35 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T54017, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 52017 - Error uploading file where it has backslahes in file metadata using PostgreSQL 9.1.9
Error uploading file where it has backslahes in file metadata using PostgreSQ...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.20.x
All Linux
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2013-07-25 09:31 UTC by Erich Lerch
Modified: 2013-10-15 23:29 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
zip-file which contains the patch-file and image with backslashes in its metadata (18.14 KB, application/zip)
2013-07-25 09:31 UTC, Erich Lerch
Details

Description Erich Lerch 2013-07-25 09:31:54 UTC
Created attachment 12955 [details]
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
Comment 1 Andre Klapper 2013-07-25 10:26:38 UTC
Hi Erich! Thanks for your patch!

You are welcome to use Developer access
  https://www.mediawiki.org/wiki/Developer_access
to submit this as a Git branch directly into Gerrit:
  https://www.mediawiki.org/wiki/Git/Tutorial

Putting your branch in Git makes it easier to review it quickly.
Thanks again! We appreciate your contribution.

Also, I highly recommend upgrading 1.20.0 to the latest 1.20.6.
Comment 2 Bartosz Dziewoński 2013-07-25 10:32:42 UTC
Or if you prefer, you can also submit pull requests on the GitHub mirror[1], which will be automatically synchronised with gerrit. (Pull request comment will become the commit message.)

[1] http://github.com/wikimedia/mediawiki-core
Comment 3 Gerrit Notification Bot 2013-10-15 23:12:17 UTC
Change 90057 had a related patch set uploaded by saper:
Escape backslashes in image metadata

https://gerrit.wikimedia.org/r/90057
Comment 4 Gerrit Notification Bot 2013-10-15 23:28:57 UTC
Change 90057 merged by jenkins-bot:
Escape backslashes in image metadata

https://gerrit.wikimedia.org/r/90057
Comment 5 Marcin Cieślak 2013-10-15 23:29:35 UTC
Thanks for the patch!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links