mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-09 04:57:18 +08:00
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:
parent
c0601798f3
commit
7fc8f24d2c
1 changed files with 7 additions and 4 deletions
|
@ -82,13 +82,16 @@ defmodule LivebookWeb.SessionLive.CellUploadComponent do
|
||||||
filename = name <> ext
|
filename = name <> ext
|
||||||
destination_file = FileSystem.File.resolve(images_dir, filename)
|
destination_file = FileSystem.File.resolve(images_dir, filename)
|
||||||
|
|
||||||
with :ok <- FileSystem.File.copy(upload_file, destination_file) do
|
result =
|
||||||
{:ok, filename}
|
with :ok <- FileSystem.File.copy(upload_file, destination_file) do
|
||||||
end
|
{:ok, filename}
|
||||||
|
end
|
||||||
|
|
||||||
|
{:ok, result}
|
||||||
end)
|
end)
|
||||||
|> case do
|
|> case do
|
||||||
[{:ok, filename}] ->
|
[{:ok, filename}] ->
|
||||||
src_path = "images/#{filename}"
|
src_path = "images/#{URI.encode(filename, &URI.char_unreserved?/1)}"
|
||||||
|
|
||||||
{:noreply,
|
{:noreply,
|
||||||
socket
|
socket
|
||||||
|
|
Loading…
Add table
Reference in a new issue