From 72e65d181d56accbf056ef654f3f4aef5b518710 Mon Sep 17 00:00:00 2001 From: ShareVB Date: Sun, 19 Apr 2026 11:25:41 +0200 Subject: [PATCH] feat(Base64 File Converter): add option to not emit data uri prefix Fix #1772 --- .../base64-file-converter.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/tools/base64-file-converter/base64-file-converter.vue b/src/tools/base64-file-converter/base64-file-converter.vue index 28cc8047..6b1fb1dc 100644 --- a/src/tools/base64-file-converter/base64-file-converter.vue +++ b/src/tools/base64-file-converter/base64-file-converter.vue @@ -70,9 +70,16 @@ function downloadFile() { } } +const includeDataUri = ref(true); const fileInput = ref() as Ref; const { base64: fileBase64 } = useBase64(fileInput); -const { copy: copyFileBase64 } = useCopy({ source: fileBase64, text: t('tools.base64-file-converter.texts.text-base64-string-copied-to-the-clipboard') }); +const cleanedFileBase64 = computed(() => { + if (includeDataUri.value) { + return fileBase64.value; + } + return fileBase64.value.replace(/^data:[^;];base64,/, ''); +}); +const { copy: copyFileBase64 } = useCopy({ source: cleanedFileBase64, text: t('tools.base64-file-converter.texts.text-base64-string-copied-to-the-clipboard') }); async function onUpload(file: File) { if (file) { @@ -128,9 +135,17 @@ async function onUpload(file: File) { - + + + + Include data: URI prefix + + + +