r87984 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87983‎ | r87984 | r87985 >
Date:15:16, 13 May 2011
Author:diebuche
Status:reverted (Comments)
Tags:
Comment:
Bug 26090 : Ignore unlikely EXIF dates in UploadWizard
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
@@ -469,8 +469,9 @@
470470 $j.each( [ 'datetimeoriginal', 'datetimedigitized', 'datetime', 'date' ], function( i, propName ) {
471471 var dateInfo = metadata[propName];
472472 if ( ! mw.isEmpty( dateInfo ) ) {
473 - var matches = $j.trim( dateInfo ).match( yyyyMmDdRegex );
474 - if ( ! mw.isEmpty( matches ) ) {
 473+ var matches = $j.trim( dateInfo ).match( yyyyMmDdRegex );
 474+ // EXIF was founded in 1995, so anything before that is very unlikely
 475+ if ( ! mw.isEmpty( matches ) && parseInt( matches[1], 10 ) > 1994) {
475476 dateObj = new Date( parseInt( matches[1], 10 ),
476477 parseInt( matches[2], 10 ) - 1,
477478 parseInt( matches[3], 10 ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r95412Revert r87984...reedy18:38, 24 August 2011
r95628MFT to REL1_18 (extensions)...hashar15:32, 28 August 2011

Comments

#Comment by NeilK (talk | contribs)   17:35, 13 May 2011

This doesn't really fix the problem. Maybe checkdate() ? http://www.php.net/manual/en/function.checkdate.php

#Comment by Reedy (talk | contribs)   18:27, 24 August 2011

That's a PHP function... The change is in JS...

#Comment by NeilK (talk | contribs)   19:00, 24 August 2011

reedy -- thanks for doing that, I was just about to

Status & tagging log