mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-08 20:46:16 +08:00
Ensure upload path is normalized (#532)
* Ensure upload path is normalized * Add TODO
This commit is contained in:
parent
2a338b6b83
commit
671c9b679e
1 changed files with 3 additions and 0 deletions
|
@ -74,6 +74,9 @@ defmodule LivebookWeb.SessionLive.CellUploadComponent do
|
||||||
%{images_dir: images_dir} = Session.get_summary(socket.assigns.session_id)
|
%{images_dir: images_dir} = Session.get_summary(socket.assigns.session_id)
|
||||||
|
|
||||||
consume_uploaded_entries(socket, :cell_image, fn %{path: path}, entry ->
|
consume_uploaded_entries(socket, :cell_image, fn %{path: path}, entry ->
|
||||||
|
# Ensure the path is normalized (see https://github.com/elixir-plug/plug/issues/1047)
|
||||||
|
# TODO: remove once we update to a Plug version with the issue resolved
|
||||||
|
path = Path.expand(path)
|
||||||
upload_file = FileSystem.File.local(path)
|
upload_file = FileSystem.File.local(path)
|
||||||
ext = Path.extname(entry.client_name)
|
ext = Path.extname(entry.client_name)
|
||||||
filename = name <> ext
|
filename = name <> ext
|
||||||
|
|
Loading…
Add table
Reference in a new issue