diff options
Diffstat (limited to 'lib/versioner/util.go')
-rw-r--r-- | lib/versioner/util.go | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/versioner/util.go b/lib/versioner/util.go index a3e9e601d8..1ee4ae2921 100644 --- a/lib/versioner/util.go +++ b/lib/versioner/util.go @@ -256,23 +256,15 @@ func restoreFile(method fs.CopyRangeMethod, src, dst fs.Filesystem, filePath str } func versionerFsFromFolderCfg(cfg config.FolderConfiguration) (versionsFs fs.Filesystem) { - params := cfg.Versioning.Params folderFs := cfg.Filesystem() - if params["fsType"] == "" && params["fsPath"] == "" { + if cfg.Versioning.FSPath == "" { versionsFs = fs.NewFilesystem(folderFs.Type(), filepath.Join(folderFs.URI(), ".stversions")) - - } else if params["fsType"] == "" { - uri := params["fsPath"] + } 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 // how to check if it's absolute or relative. - if folderFs.Type() == fs.FilesystemTypeBasic && !filepath.IsAbs(params["fsPath"]) { - uri = filepath.Join(folderFs.URI(), params["fsPath"]) - } - versionsFs = fs.NewFilesystem(folderFs.Type(), uri) + versionsFs = fs.NewFilesystem(cfg.Versioning.FSType, filepath.Join(folderFs.URI(), cfg.Versioning.FSPath)) } else { - var fsType fs.FilesystemType - _ = fsType.UnmarshalText([]byte(params["fsType"])) - versionsFs = fs.NewFilesystem(fsType, params["fsPath"]) + versionsFs = fs.NewFilesystem(cfg.Versioning.FSType, cfg.Versioning.FSPath) } l.Debugf("%s (%s) folder using %s (%s) versioner dir", folderFs.URI(), folderFs.Type(), versionsFs.URI(), versionsFs.Type()) return |