refactor: Use filepath.ToSlash explicitly for FileConfig, name, to and from params
This commit is contained in:
@@ -11,6 +11,6 @@ curl -L -o /tmp/bagccgop "https://github.com/pojntfx/bagccgop/releases/latest/do
|
||||
install /tmp/bagccgop /usr/local/bin
|
||||
|
||||
# Build
|
||||
GOFLAGS='-gccgoflags=-static' bagccgop -x '(linux/alpha|linux/mipsle)' -j1 -b stfs -r 'make depend' -s 'build-essential,automake' -m 'libsqlite3-dev' -p 'make build/stfs DST=$DST' -d out
|
||||
GOFLAGS='-gccgoflags=-static' bagccgop -x '(linux/alpha|linux/mipsle|linux/ppc)' -j1 -b stfs -r 'make depend' -s 'build-essential,automake' -m 'libsqlite3-dev' -p 'make build/stfs DST=$DST' -d out
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -131,8 +131,8 @@ var operationArchiveCmd = &cobra.Command{
|
||||
return os.Open(path)
|
||||
},
|
||||
Info: info,
|
||||
Path: path,
|
||||
Link: link,
|
||||
Path: filepath.ToSlash(path),
|
||||
Link: filepath.ToSlash(link),
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -121,8 +121,8 @@ var operationUpdateCmd = &cobra.Command{
|
||||
return os.Open(path)
|
||||
},
|
||||
Info: info,
|
||||
Path: path,
|
||||
Link: link,
|
||||
Path: filepath.ToSlash(path),
|
||||
Link: filepath.ToSlash(link),
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"archive/tar"
|
||||
"context"
|
||||
"database/sql"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/pojntfx/stfs/internal/converters"
|
||||
@@ -18,6 +19,8 @@ func Stat(
|
||||
|
||||
onHeader func(hdr *models.Header),
|
||||
) (*tar.Header, error) {
|
||||
name = filepath.ToSlash(name)
|
||||
|
||||
dbhdr, err := metadata.Metadata.GetHeader(context.Background(), name)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"io/fs"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pojntfx/stfs/internal/compression"
|
||||
"github.com/pojntfx/stfs/internal/converters"
|
||||
@@ -34,6 +35,8 @@ func Fetch(
|
||||
|
||||
onHeader func(hdr *models.Header),
|
||||
) error {
|
||||
to = filepath.ToSlash(to)
|
||||
|
||||
var tr *tar.Reader
|
||||
if reader.DriveIsRegular {
|
||||
// Seek to record and block
|
||||
|
||||
Reference in New Issue
Block a user