Skip to content

Commit

Permalink
br: fix incorrect uri for the file storage (#48453)
Browse files Browse the repository at this point in the history
close #48452
  • Loading branch information
3AceShowHand authored Nov 20, 2023
1 parent 7db44c0 commit 49d1b66
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion br/pkg/storage/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (l *LocalStorage) WalkDir(_ context.Context, opt *WalkOption, fn func(strin

// URI returns the base path as an URI with a file:/// prefix.
func (l *LocalStorage) URI() string {
return LocalURIPrefix + "/" + l.base
return LocalURIPrefix + l.base
}

// Open a Reader by file path, path is a relative path to base path.
Expand Down
14 changes: 14 additions & 0 deletions br/pkg/storage/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@ func TestWalkDirSkipSubDir(t *testing.T) {
}))
}

func TestLocalURI(t *testing.T) {
ctx := context.Background()

url := "file:///tmp/folder"
sb, err := ParseBackend(url, &BackendOptions{})
require.NoError(t, err)

store, err := Create(ctx, sb, true)
require.NoError(t, err)

obtained := store.URI()
require.Equal(t, url, obtained)
}

func TestLocalFileReadRange(t *testing.T) {
ctx := context.Background()
dir := t.TempDir()
Expand Down

0 comments on commit 49d1b66

Please sign in to comment.