From 824775937adfa67abdaab5cb1fa90833725b8026 Mon Sep 17 00:00:00 2001 From: Alex Hirzel Date: Sat, 24 Feb 2024 11:15:38 -0500 Subject: [PATCH] a straw man for getting data out of LocalResources --- src/Resource.jl | 2 ++ test/runtests.jl | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Resource.jl b/src/Resource.jl index 182bff3d..f50192ee 100644 --- a/src/Resource.jl +++ b/src/Resource.jl @@ -101,6 +101,8 @@ function LocalResource(path::AbstractString, html_attributes::Pair...) Resource(src, mime, html_attributes) end +Vector{UInt8}(r::PlutoUI.Resource) = Base64.base64decode(split(r.src, ',', limit=2) |> last) + ### # DOWNLOAD BUTTON ### diff --git a/test/runtests.jl b/test/runtests.jl index 733fe81f..8831d544 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -129,8 +129,9 @@ end occursin("https://asdf.com/a/b/c.mp4?b=23f&c=asdf.png", h4) ) @test occursin(r"asdf=[\'\"]123px", h5) - - + @test Vector{UInt8}(r3) == Vector{UInt8}("asdf") + + end @testset "DownloadButton" begin