From 53002e44ae3cb99212106d4221328795115efd0a Mon Sep 17 00:00:00 2001 From: Cam Graff Date: Sat, 16 Sep 2023 16:05:31 -0500 Subject: [PATCH] Use hostname in 'open' URI This enables `lemonade open` to work correctly over ssh --- client/client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index 904e21d..07c8d1d 100644 --- a/client/client.go +++ b/client/client.go @@ -64,7 +64,12 @@ func serveFile(fname string) (string, <-chan struct{}, error) { })) }() - return fmt.Sprintf("http://127.0.0.1:%d/%s", l.Addr().(*net.TCPAddr).Port, fname), finished, nil + hostname, err := os.Hostname() + if err != nil { + return "", nil, err + } + + return fmt.Sprintf("http://%s:%d/%s", hostname, l.Addr().(*net.TCPAddr).Port, fname), finished, nil } func (c *client) Open(uri string, transLocalfile, transLoopback bool) error {