mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-24 04:15:57 +08:00
fix: path should be URL-encoded in Elixir code (#2926)
Signed-off-by: Cocoa <i@uwucocoa.moe> Co-authored-by: Wojtek Mach <wojtekmach@users.noreply.github.com>
This commit is contained in:
parent
61bce0f39b
commit
465d711395
3 changed files with 8 additions and 3 deletions
|
@ -110,7 +110,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
}
|
||||
|
||||
for url in urls {
|
||||
ElixirKit.API.publish("open", url.absoluteString)
|
||||
ElixirKit.API.publish("open", "file://\(url.path)")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ static class LivebookMain
|
|||
|
||||
if (args.Length == 1 && args[0].StartsWith(prefix))
|
||||
{
|
||||
var uri = new System.Uri(args[0].Remove(0, prefix.Length));
|
||||
url = uri.AbsoluteUri;
|
||||
url = $"file://{args[0].Remove(0, prefix.Length)}";
|
||||
}
|
||||
|
||||
var logPath = getLogPath();
|
||||
|
|
|
@ -21,6 +21,12 @@ defmodule Livebook.UtilsTest do
|
|||
|
||||
assert Livebook.Utils.expand_desktop_url("file://c\\foo.txt") ==
|
||||
"http://localhost:4002/open?path=c%5Cfoo.txt"
|
||||
|
||||
assert Livebook.Utils.expand_desktop_url("file:///this is a dir/with many spaces/foo.txt") ==
|
||||
"http://localhost:4002/open?path=%2Fthis+is+a+dir%2Fwith+many+spaces%2Ffoo.txt"
|
||||
|
||||
assert Livebook.Utils.expand_desktop_url("file://\\\\127.0.0.1\\my folder\\foo.txt") ==
|
||||
"http://localhost:4002/open?path=%5C%5C127.0.0.1%5Cmy+folder%5Cfoo.txt"
|
||||
end
|
||||
|
||||
test "livebook://" do
|
||||
|
|
Loading…
Add table
Reference in a new issue