Inchikutty has uploaded a new change for review.

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

Change subject: Preserve title when fetching original file from Flickr
......................................................................

Preserve title when fetching original file from Flickr

to fix "Flickr Upload title truncated on first occurrence of the
dot (.) character"

Bug: 65931
Change-Id: Ie5153c0afe6b6cd91f9f528d1d071c187440576e
---
M resources/mw.FlickrChecker.js
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/19/141219/1

diff --git a/resources/mw.FlickrChecker.js b/resources/mw.FlickrChecker.js
index 4e5ab27..e7a162b 100644
--- a/resources/mw.FlickrChecker.js
+++ b/resources/mw.FlickrChecker.js
@@ -583,6 +583,8 @@
                        method: 'flickr.photos.getSizes',
                        photo_id: photoId
                } ).done( function( data ) {
+                       var nameParts;
+
                        if ( typeof data.sizes !== 'undefined' && typeof 
data.sizes.size !== 'undefined' && data.sizes.size.length > 0 )
                        {
                                // Flickr always returns the largest version as 
the final size.
@@ -591,7 +593,12 @@
                                // Flickr provides the original format for 
images coming from pro users, hence we need to change the default JPEG to this 
format
                                if ( largestSize.label === 'Original' ) {
                                        upload.type = upload.originalFormat;
-                                       upload.name = upload.name.split('.')[0] 
+ '.' + upload.originalFormat;
+
+                                       nameParts = upload.name.split( '.' );
+                                       if ( nameParts.length > 1 ) {
+                                               nameParts.pop();
+                                       }
+                                       upload.name = nameParts.join( '.' ) + 
'.' + upload.originalFormat;
                                }
                                upload.url = largestSize.source;
                                // Need to call the newUpload here, otherwise 
some code would have to be written to detect the completion of the API call.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5153c0afe6b6cd91f9f528d1d071c187440576e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: osm
Gerrit-Owner: Inchikutty <[email protected]>
Gerrit-Reviewer: Rillke <[email protected]>

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

Reply via email to