From 0cbd7b08fd3591f44f97824eaf16445bebf4959e Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Sat, 4 Nov 2023 15:50:56 +0100 Subject: [PATCH] Update Resource.jl --- src/Resource.jl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Resource.jl b/src/Resource.jl index 3e72e540..4910232b 100644 --- a/src/Resource.jl +++ b/src/Resource.jl @@ -140,12 +140,16 @@ DownloadButton(data) = DownloadButton(data, "result") function Base.show(io::IO, m::MIME"text/html", db::DownloadButton) mime = mime_fromfilename(db.filename) - data = to_data(db.data, mime) + data = if db.data isa String || db.data isa AbstractVector{UInt8} || isnothing(mime) + db.data + else + repr(mime, db.data) + end write(io, " ") @@ -153,7 +157,7 @@ function Base.show(io::IO, m::MIME"text/html", db::DownloadButton) write(io, "") end -function to_data(object::Any, mime::Union{MIME, Nothing})::String +function downloadbutton_data(object::Any, mime::Union{MIME, Nothing})::String data = if object isa String || object isa AbstractVector{UInt8} || isnothing(mime) object else