Skip to content

Commit

Permalink
br: fix incorrect uri for the file storage (#48453) (#48721)
Browse files Browse the repository at this point in the history
close #48452
  • Loading branch information
ti-chi-bot authored Nov 24, 2023

Unverified

This user has not yet uploaded their public signing key.
1 parent 40512ea commit 97c0f49
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
@@ -121,7 +121,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.
14 changes: 14 additions & 0 deletions br/pkg/storage/local_test.go
Original file line number Diff line number Diff line change
@@ -127,3 +127,17 @@ func TestWalkDirWithSoftLinkFile(t *testing.T) {
})
require.NoError(t, err)
}

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)
}

0 comments on commit 97c0f49

Please sign in to comment.