From a201722f6d9e94dcd071154287416f53b7423089 Mon Sep 17 00:00:00 2001 From: Tyler Pham Date: Thu, 1 Dec 2016 14:12:01 -0500 Subject: [PATCH] CB-11714: (windows) added extra check for content-type in savePhoto() without options.targetWidth/Height --- src/windows/CameraProxy.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js index eb10cd2a2..aee07a7c2 100644 --- a/src/windows/CameraProxy.js +++ b/src/windows/CameraProxy.js @@ -800,9 +800,16 @@ function savePhoto(picture, options, successCallback, errorCallback) { if (options.targetHeight > 0 && options.targetWidth > 0) { resizeImage(successCallback, errorCallback, picture, options.targetWidth, options.targetHeight, options.encodingType); } else { - picture.copyAsync(getAppData().localFolder, picture.name, OptUnique).done(function (copiedFile) { - successCallback("ms-appdata:///local/" + copiedFile.name); - },errorCallback); + // CB-11714: check if target content-type is PNG to just rename as *.jpg since camera is captured as JPEG + var pictureName = picture.name; + + if (options.encodingType === Camera.EncodingType.PNG) { + pictureName = pictureName.replace(/\.png$/, ".jpg"); + } + + picture + .copyAsync(getAppData().localFolder, pictureName, OptUnique) + .done(function (copiedFile) { successCallback("ms-appdata:///local/" + copiedFile.name); }, errorCallback); } } else { if (options.targetHeight > 0 && options.targetWidth > 0) {