mirror of
				https://github.com/livebook-dev/livebook.git
				synced 2025-10-25 04:46:04 +08:00 
			
		
		
		
	Expand path before opening it
Say we have this path on Windows: `C:/Users/wojtek/foo.livemd`. Opening
it: (ignore it's not escaped)
    http://localhost:4000/open?path=C:/Users/wojtek/foo.livemd
would have failed with:
    ** (ArgumentError) expected an expanded absolute path, got: "C:/Users/wojtek/foo.livemd"
and that's because absolute paths (in other words, Path expanded) start
with `c:/`, not `C:/`.
			
			
This commit is contained in:
		
							parent
							
								
									1dc7c43b70
								
							
						
					
					
						commit
						864624ad2c
					
				
					 1 changed files with 1 additions and 0 deletions
				
			
		|  | @ -189,6 +189,7 @@ defmodule LivebookWeb.HomeLive do | |||
| 
 | ||||
|   def handle_params(%{"path" => path} = _params, _uri, socket) | ||||
|       when socket.assigns.live_action == :public_open do | ||||
|     path = Path.expand(path) | ||||
|     file = FileSystem.File.local(path) | ||||
| 
 | ||||
|     if file_running?(file, socket.assigns.sessions) do | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue