From 671c9b679e689f3b861eb2400e7576fad41a323b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Tue, 31 Aug 2021 13:17:38 +0200 Subject: [PATCH] Ensure upload path is normalized (#532) * Ensure upload path is normalized * Add TODO --- lib/livebook_web/live/session_live/cell_upload_component.ex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/livebook_web/live/session_live/cell_upload_component.ex b/lib/livebook_web/live/session_live/cell_upload_component.ex index 168d16117..85b77444c 100644 --- a/lib/livebook_web/live/session_live/cell_upload_component.ex +++ b/lib/livebook_web/live/session_live/cell_upload_component.ex @@ -74,6 +74,9 @@ defmodule LivebookWeb.SessionLive.CellUploadComponent do %{images_dir: images_dir} = Session.get_summary(socket.assigns.session_id) 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) ext = Path.extname(entry.client_name) filename = name <> ext