Skip to content

Commit 2f8f4e7

Browse files
committed
Fix format selection when saving a palette in the Electron app
This commit addresses an issue in the Electron app where the file format selected in the "Save as type" dropdown, or chosen by typing the file extension, was not respected when saving a palette. It saved always in GIMP Palette file format, due to the palette formats not having defined `mimeType` properties. Color palette formats have virtually no MIME type consensus, but using the AnyPalette.js format identifiers works fine here. For image formats, the `formatID` is the same as the `mimeType`, so this change should have no effect on image file saving. Steps to reproduce: - Run the electron app: `npm run electron:start` - Click Colors > Save Colors - Select "Sketch palette (*.sketchpalette)" for "Save as type" - Enter a file name (ending with .sketchpalette) and click Save - The saved file should match the chosen format (JSON-based for Sketch)
1 parent 806cca3 commit 2f8f4e7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/electron-injected.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ window.systemHooks.showSaveFileDialog = async ({ formats, defaultFileName, defau
137137
if (!format) {
138138
return show_error_message(`Can't save as *.${extension} - Try adding .png to the end of the file name`);
139139
}
140-
const blob = await getBlob(format.mimeType);
140+
const blob = await getBlob(format.formatID);
141141
const { responseCode, error } = await write_blob_to_file_path(filePath, blob);
142142
if (responseCode !== "SUCCESS") {
143143
return show_save_error_message(responseCode, error);
144144
}
145145
savedCallbackUnreliable && savedCallbackUnreliable({
146146
// newFileName: path.basename(filePath),
147147
newFileName: fileName,
148-
newFileFormatID: format.mimeType,
148+
newFileFormatID: format.formatID,
149149
newFileHandle: filePath,
150150
newBlob: blob,
151151
});

0 commit comments

Comments
 (0)