refactor: Use filepath.ToSlash explicitly for FileConfig, name, to and from params
This commit is contained in:
@@ -3,6 +3,7 @@ package operations
|
||||
import (
|
||||
"archive/tar"
|
||||
"context"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pojntfx/stfs/internal/converters"
|
||||
models "github.com/pojntfx/stfs/internal/db/sqlite/models/metadata"
|
||||
@@ -15,6 +16,8 @@ import (
|
||||
)
|
||||
|
||||
func (o *Operations) Delete(name string) error {
|
||||
name = filepath.ToSlash(name)
|
||||
|
||||
o.diskOperationLock.Lock()
|
||||
defer o.diskOperationLock.Unlock()
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package operations
|
||||
import (
|
||||
"archive/tar"
|
||||
"context"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/pojntfx/stfs/internal/converters"
|
||||
@@ -16,6 +17,8 @@ import (
|
||||
)
|
||||
|
||||
func (o *Operations) Move(from string, to string) error {
|
||||
from, to = filepath.ToSlash(from), filepath.ToSlash(to)
|
||||
|
||||
// Ignore no-op move operation
|
||||
if from == to {
|
||||
return nil
|
||||
|
||||
@@ -23,6 +23,8 @@ func (o *Operations) Restore(
|
||||
to string,
|
||||
flatten bool,
|
||||
) error {
|
||||
from, to = filepath.ToSlash(from), filepath.ToSlash(to)
|
||||
|
||||
o.diskOperationLock.Lock()
|
||||
defer o.diskOperationLock.Unlock()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user