Skip to content

Commit

Permalink
updated changelog and godoc
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Dec 29, 2022
1 parent 775417a commit 8f6cb5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Fixed the text wrapping in the Admin UI listing searchbar ([#1416](https://github.com/pocketbase/pocketbase/issues/1416)).

- Added `filesystem.NewFileFromBytes()` helper ([#1420](https://github.com/pocketbase/pocketbase/pull/1420); thanks @dschissler).


## v0.10.4

Expand Down
6 changes: 4 additions & 2 deletions tools/filesystem/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func NewFileFromMultipart(mh *multipart.FileHeader) (*File, error) {

var _ FileReader = (*MultipartReader)(nil)

// MultipartReader defines a [multipart.FileHeader] reader.
// MultipartReader defines a FileReader from [multipart.FileHeader].
type MultipartReader struct {
Header *multipart.FileHeader
}
Expand All @@ -95,6 +95,7 @@ func (r *MultipartReader) Open() (io.ReadSeekCloser, error) {

var _ FileReader = (*PathReader)(nil)

// PathReader defines a FileReader from a local file path.
type PathReader struct {
Path string
}
Expand All @@ -108,6 +109,7 @@ func (r *PathReader) Open() (io.ReadSeekCloser, error) {

var _ FileReader = (*BytesReader)(nil)

// BytesReader defines a FileReader from bytes content.
type BytesReader struct {
Bytes []byte
}
Expand All @@ -117,11 +119,11 @@ func (r *BytesReader) Open() (io.ReadSeekCloser, error) {
return &bytesReadSeekCloser{bytes.NewReader(r.Bytes)}, nil
}

// bytesReadSeekCloser implements io.ReadSeekCloser
type bytesReadSeekCloser struct {
*bytes.Reader
}

// Close implements the [io.ReadSeekCloser] interface.
func (r *bytesReadSeekCloser) Close() error {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions tools/filesystem/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestNewFileFromPath(t *testing.T) {
t.Fatalf("Expected nil error, got %v", err)
}
if f.OriginalName != originalName {
t.Fatalf("Expected originalName %q, got %q", originalName, f.OriginalName)
t.Fatalf("Expected OriginalName %q, got %q", originalName, f.OriginalName)
}
if match, _ := regexp.Match(normalizedNamePattern, []byte(f.Name)); !match {
t.Fatalf("Expected Name to match %v, got %q (%v)", normalizedNamePattern, f.Name, err)
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestNewFileFromBytes(t *testing.T) {
t.Fatalf("Expected Size %v, got %v", 5, f.Size)
}
if f.OriginalName != originalName {
t.Fatalf("Expected originalName %q, got %q", originalName, f.OriginalName)
t.Fatalf("Expected OriginalName %q, got %q", originalName, f.OriginalName)
}
if match, _ := regexp.Match(normalizedNamePattern, []byte(f.Name)); !match {
t.Fatalf("Expected Name to match %v, got %q (%v)", normalizedNamePattern, f.Name, err)
Expand Down

0 comments on commit 8f6cb5a

Please sign in to comment.