Sniff image MIME for ZK viewer blobs so save-as gets a real extension.
This commit is contained in:
@@ -3,6 +3,7 @@ import { ref } from 'vue';
|
||||
import { api } from '@/plugins/axios';
|
||||
import type { GetZkUploadCiphertextResult } from '@/types/upload/GetZkUploadCiphertextResult';
|
||||
import { base64ToBytes } from '@/utils/encoding/base64ToBytes';
|
||||
import { detectImageMimeType } from '@/utils/file/detectImageMimeType';
|
||||
import { toArrayBuffer } from '@/utils/toArrayBuffer';
|
||||
import { decryptPasswordProtectedZkUpload } from '@/utils/upload/decryptPasswordProtectedZkUpload';
|
||||
import { decryptZkUpload } from '@/utils/upload/decryptZkUpload';
|
||||
@@ -67,7 +68,9 @@ export const useZkViewStore = defineStore('zkView', () => {
|
||||
throw new Error('Could not build image blob');
|
||||
}
|
||||
|
||||
imageObjectUrl.value = URL.createObjectURL(new Blob([buffer]));
|
||||
const mimeType = await detectImageMimeType(plaintext);
|
||||
|
||||
imageObjectUrl.value = URL.createObjectURL(new Blob([buffer], { type: mimeType }));
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user