Fix image uploads in Markdown cells (#945)

* Fix call to consume_uploaded_entries to match changes in LV

* Escape reserved characters when inserting image in a Markdown cell
This commit is contained in:
Jonatan Kłosko 2022-01-27 15:47:04 +01:00 committed by GitHub
parent c0601798f3
commit 7fc8f24d2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,13 +82,16 @@ defmodule LivebookWeb.SessionLive.CellUploadComponent do
filename = name <> ext
destination_file = FileSystem.File.resolve(images_dir, filename)
with :ok <- FileSystem.File.copy(upload_file, destination_file) do
{:ok, filename}
end
result =
with :ok <- FileSystem.File.copy(upload_file, destination_file) do
{:ok, filename}
end
{:ok, result}
end)
|> case do
[{:ok, filename}] ->
src_path = "images/#{filename}"
src_path = "images/#{URI.encode(filename, &URI.char_unreserved?/1)}"
{:noreply,
socket