MCPcopy
hub / github.com/wavetermdev/waveterm / addExtensionIfNeeded

Function addExtensionIfNeeded

emain/emain-ipc.ts:157–163  ·  view source on GitHub ↗
(fileName: string, mimeType: string)

Source from the content-addressed store, hash-verified

155 "image/svg+xml": "svg",
156 };
157 function addExtensionIfNeeded(fileName: string, mimeType: string): string {
158 const extension = mimeToExtension[mimeType];
159 if (!path.extname(fileName) && extension) {
160 return `${fileName}.${extension}`;
161 }
162 return fileName;
163 }
164 defaultFileName = addExtensionIfNeeded(defaultFileName, mimeType);
165 electron.dialog
166 .showSaveDialog(ww, {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected