diff options
Diffstat (limited to 'lib/versioner/util.go')
-rw-r--r-- | lib/versioner/util.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/versioner/util.go b/lib/versioner/util.go index cb7773da3..a0bcfba1e 100644 --- a/lib/versioner/util.go +++ b/lib/versioner/util.go @@ -262,10 +262,20 @@ func versionerFsFromFolderCfg(cfg config.FolderConfiguration) (versionsFs fs.Fil folderFs := cfg.Filesystem(nil) if cfg.Versioning.FSPath == "" { versionsFs = fs.NewFilesystem(folderFs.Type(), filepath.Join(folderFs.URI(), DefaultPath)) - } else if cfg.Versioning.FSType == fs.FilesystemTypeBasic && !filepath.IsAbs(cfg.Versioning.FSPath) { - // We only know how to deal with relative folders for basic filesystems, as that's the only one we know + } else if cfg.Versioning.FSType == fs.FilesystemTypeBasic { + // Expand any leading tildes for basic filesystems, + // before checking for absolute paths. + path, err := fs.ExpandTilde(cfg.Versioning.FSPath) + if err != nil { + path = cfg.Versioning.FSPath + } + // We only know how to deal with relative folders for + // basic filesystems, as that's the only one we know // how to check if it's absolute or relative. - versionsFs = fs.NewFilesystem(cfg.Versioning.FSType, filepath.Join(folderFs.URI(), cfg.Versioning.FSPath)) + if !filepath.IsAbs(path) { + path = filepath.Join(folderFs.URI(), path) + } + versionsFs = fs.NewFilesystem(cfg.Versioning.FSType, path) } else { versionsFs = fs.NewFilesystem(cfg.Versioning.FSType, cfg.Versioning.FSPath) } |