@bindu-dashing/dam-solution-v2 5.9.265 → 5.9.266
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -69,8 +69,20 @@ const ImageEditorComponent = ({ file, handleClose, }) => {
|
|
|
69
69
|
}
|
|
70
70
|
setState((prev) => (Object.assign(Object.assign({}, prev), { loading: true, confirmOpen: false })));
|
|
71
71
|
try {
|
|
72
|
+
// The editor always exports PNG (getEditedFile forces it) so the "Remove
|
|
73
|
+
// White" / Transparent tool's alpha channel survives. But a non-PNG
|
|
74
|
+
// original keeps its old identity here: the file record still says
|
|
75
|
+
// image/jpeg and its name ends in .jpg, so the backend regenerates the
|
|
76
|
+
// thumbnail as JPEG — which has no alpha — and the gallery shows the
|
|
77
|
+
// cleared pixels as opaque. PNG sources work only because their identity
|
|
78
|
+
// stays PNG end-to-end. Promote the record to PNG so JPGs behave the same.
|
|
79
|
+
const editedMimetype = editedFile.type || "image/png";
|
|
80
|
+
// editedFile.name is the original base name with a forced .png extension.
|
|
81
|
+
const editedName = get(editedFile, "name") || get(file, "name");
|
|
72
82
|
const response = yield api.put(SAVE_EDITED_FILE_URL, {
|
|
73
83
|
path: get(file, "s3Path"),
|
|
84
|
+
mimetype: editedMimetype,
|
|
85
|
+
name: editedName,
|
|
74
86
|
});
|
|
75
87
|
const url = get(response, "data");
|
|
76
88
|
if (!url) {
|
|
@@ -83,12 +95,15 @@ const ImageEditorComponent = ({ file, handleClose, }) => {
|
|
|
83
95
|
const s3Resp = yield fetch(url, {
|
|
84
96
|
method: "PUT",
|
|
85
97
|
headers: {
|
|
86
|
-
"Content-Type":
|
|
98
|
+
"Content-Type": editedMimetype,
|
|
87
99
|
},
|
|
88
100
|
body: editedFile,
|
|
89
101
|
});
|
|
90
102
|
if (s3Resp.ok) {
|
|
91
|
-
yield api.put(SAVE_EDITED_FILE_THUMBNAIL_URL.replace(":fileId", get(file, "_id")),
|
|
103
|
+
yield api.put(SAVE_EDITED_FILE_THUMBNAIL_URL.replace(":fileId", get(file, "_id")),
|
|
104
|
+
// Pass the new format so the regenerated thumbnail is also PNG and
|
|
105
|
+
// keeps the transparency instead of being flattened back to JPEG.
|
|
106
|
+
{ mimetype: editedMimetype, name: editedName });
|
|
92
107
|
invalidateAfterChange();
|
|
93
108
|
showNotification(UPDATE_SUCCESS, NotificationStatus.SUCCESS);
|
|
94
109
|
handleClose();
|