Ensure upload path is normalized (#532)

* Ensure upload path is normalized

* Add TODO
This commit is contained in:
Jonatan Kłosko 2021-08-31 13:17:38 +02:00 committed by GitHub
parent 2a338b6b83
commit 671c9b679e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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