Skip to content

Error in jsonlite::base64_dec(file$content) when using shortcode to include files #159

@gadenbuie

Description

@gadenbuie

When using gadenbuie/quarto-base64 to include files in a shinylive app chunk, shinylive throws this non-blocking error

Error in jsonlite::base64_dec(file$content) : Error in base64 decode

Here's a simple demo using the quarto.png and shiny.png logos from https://github.com/rstudio/hex-stickers

---
title: "Reprex"
format: html
filters:
    - shinylive
    - base64
---

```{shinylive-r}
#| standalone: true
#| viewerHeight: 550
#| components: [editor, viewer]

## file: app.R
{{< include app.R >}}

## file: quarto.png
## type: binary
{{< base64 quarto.png >}}

## file: shiny.png
## type: binary
{{< base64 shiny.png >}}
```

with app.R:

library(shiny)

ui <- fluidPage(
  selectInput(
    "pict",
    "Pick a logo",
    choices = c("Quarto" = "quarto", "Shiny" = "shiny")
  ),
  imageOutput("logo")
)

server <- function(input, output, session) {
  output$logo <- renderImage(
    {
      list(
        src = file.path(paste0(input$pict, ".png")),
        contentType = "image/png",
        width = 240,
        height = 277
      )
    },
    deleteFile = FALSE
  )
}

shinyApp(ui, server)

reprex.zip

Reported at https://forum.posit.co/t/again-shinylive-with-renderimage-new-base64-quarto-extension/203838/2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions