Skip to content

Commit 630fb25

Browse files
Correct content type checks on client
1 parent 29b6420 commit 630fb25

File tree

2 files changed

+3
-2
lines changed
  • application/client/src/app

2 files changed

+3
-2
lines changed

application/client/src/app/module/ipc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ export interface Clipboard {
9494
* @param mime - MIME type of the data (e.g. `text/plain`, `image/png`).
9595
* @param data - Content as an ArrayBuffer.
9696
*/
97-
write(mime: string, data: ArrayBuffer): Promise<void>;
97+
write(mime: string | undefined, data: ArrayBuffer): Promise<void>;
9898
}

application/client/src/app/ui/views/sidebar/attachments/preview/image/component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,14 @@ export class Preview extends ChangesDetector implements AfterViewInit, AfterCont
206206
this.log().warn(`Fail to fetch image as Blob`);
207207
return;
208208
}
209+
const contentType = response.type.trim();
209210
response
210211
.arrayBuffer()
211212
.then((buffer) => {
212213
// We are using native clipboard API, but not browser one (navigator.clipboard)
213214
// to avoid possible issues with size of blob.
214215
window.electron.clipboard
215-
.write(response.type || 'application/octet-stream', buffer)
216+
.write(contentType.length > 0 ? contentType : undefined, buffer)
216217
.catch((err: Error) => {
217218
this.log().warn(
218219
`Fail to copy image into clipboard: ${err.message}`,

0 commit comments

Comments
 (0)