From 6ac395a706a3939c5011b77eedb1a6939f9fbd7e Mon Sep 17 00:00:00 2001 From: loudoweb Date: Mon, 23 Nov 2020 10:52:46 +0100 Subject: [PATCH] remove garbage from bytes when saving a file on html5, see : https://community.openfl.org/t/problem-with-filereference-save-xml/12776/2 --- src/lime/ui/FileDialog.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lime/ui/FileDialog.hx b/src/lime/ui/FileDialog.hx index fee1ee5b5..f9d2284fa 100644 --- a/src/lime/ui/FileDialog.hx +++ b/src/lime/ui/FileDialog.hx @@ -223,6 +223,7 @@ class FileDialog var path = defaultPath != null ? Path.withoutDirectory(defaultPath) : "download" + defaultExtension; var buffer = (data : Bytes).getData(); + buffer = buffer.slice(0, (data:Bytes).length); #if commonjs untyped #if haxe4 js.Syntax.code #else __js__ #end("require ('file-saver')")(new Blob([buffer], {type: type}), path, true);