Skip to content

Commit a201722

Browse files
CB-11714: (windows) added extra check for content-type in savePhoto() without options.targetWidth/Height
1 parent c9e6a9a commit a201722

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/windows/CameraProxy.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,16 @@ function savePhoto(picture, options, successCallback, errorCallback) {
800800
if (options.targetHeight > 0 && options.targetWidth > 0) {
801801
resizeImage(successCallback, errorCallback, picture, options.targetWidth, options.targetHeight, options.encodingType);
802802
} else {
803-
picture.copyAsync(getAppData().localFolder, picture.name, OptUnique).done(function (copiedFile) {
804-
successCallback("ms-appdata:///local/" + copiedFile.name);
805-
},errorCallback);
803+
// CB-11714: check if target content-type is PNG to just rename as *.jpg since camera is captured as JPEG
804+
var pictureName = picture.name;
805+
806+
if (options.encodingType === Camera.EncodingType.PNG) {
807+
pictureName = pictureName.replace(/\.png$/, ".jpg");
808+
}
809+
810+
picture
811+
.copyAsync(getAppData().localFolder, pictureName, OptUnique)
812+
.done(function (copiedFile) { successCallback("ms-appdata:///local/" + copiedFile.name); }, errorCallback);
806813
}
807814
} else {
808815
if (options.targetHeight > 0 && options.targetWidth > 0) {

0 commit comments

Comments
 (0)