Skip to content

Character truncation of an <img> tag in the compiled version. #1120

Open
@romefeller

Description

@romefeller
I have the following snippet:

connectPlot :: (DomBuilder t m, Prerender t m) => String -> m ()
connectPlot svg = do
  prerender_ blank $ do
    postBuild <- getPostBuild
    logEvent (svg <$ postBuild)
    elAttr "div" ("style" =: "width: 100%; height: 100%;") $
      elAttr "img" ("src" =: T.pack svg <> "style" =: "width: 100%; height: auto;") blank

When running with `ob run`, the image renders correctly.
However, when compiled, the <img> element only displays the first character of the src, which is "d"
(from the Base64 URI starting with "data:image/svg+xml;base64,...").

The `logEvent` function logs the full value to the browser console correctly, for example:

data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2Zy...

But the rendered output in the browser becomes:

<img src="d" ...>

Any ideas on what’s causing this issue in the compiled version (nix-build -A exe)?

@alexfmpe @ali-abrar

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