From fa4460e4819b6a41e1150a94afad5cb0f4dffaed Mon Sep 17 00:00:00 2001 From: Hunter Larco Date: Sat, 17 Jan 2026 12:01:33 -0500 Subject: [PATCH 1/2] resolve symlinks --- lib/config.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/config.go b/lib/config.go index a7bace7..e8a7844 100644 --- a/lib/config.go +++ b/lib/config.go @@ -189,6 +189,15 @@ func (cfg *Config) init() error { cfg.SourcePath = filepath.Clean(cfg.SourcePath) + // Resolve symlinks + { + re, err := filepath.EvalSymlinks(cfg.SourcePath) + if err != nil { + return errors.New("failed to resolve symlink " + err.Error()) + } + cfg.SourcePath = re + } + // Sanity check to prevent people from uploading their entire disk. // The returned path from filepath.Clean ends in a slash only if it represents // a root directory, such as "/" on Unix or `C:\` on Windows. From d46eb22a37400f22beb91516f9a50d136d39135f Mon Sep 17 00:00:00 2001 From: Hunter Larco Date: Sun, 18 Jan 2026 21:51:26 -0500 Subject: [PATCH 2/2] remove scope --- lib/config.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/config.go b/lib/config.go index e8a7844..859e36e 100644 --- a/lib/config.go +++ b/lib/config.go @@ -190,13 +190,11 @@ func (cfg *Config) init() error { cfg.SourcePath = filepath.Clean(cfg.SourcePath) // Resolve symlinks - { - re, err := filepath.EvalSymlinks(cfg.SourcePath) - if err != nil { - return errors.New("failed to resolve symlink " + err.Error()) - } - cfg.SourcePath = re + re, err := filepath.EvalSymlinks(cfg.SourcePath) + if err != nil { + return errors.New("failed to resolve symlink " + err.Error()) } + cfg.SourcePath = re // Sanity check to prevent people from uploading their entire disk. // The returned path from filepath.Clean ends in a slash only if it represents @@ -260,7 +258,7 @@ func (cfg *Config) init() error { } // load additional config (routes) from file if it exists. - err := cfg.loadFileConfig() + err = cfg.loadFileConfig() if err != nil { return fmt.Errorf("failed to load config from %s: %s", cfg.ConfigFile, err) }