Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,5 @@ type FileInfo struct {
Name string
Size int64
ModTime time.Time
MimeType string
}
8 changes: 8 additions & 0 deletions workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func TestWriteReadAndDeleteFileFromWorkspace(t *testing.T) {
t.Errorf("Unexpected file mod time: %v", fileInfo.ModTime)
}

if fileInfo.MimeType != "text/plain" {
t.Errorf("Unexpected file mime type: %s", fileInfo.MimeType)
}

// Ensure we get the error we expect when trying to read a non-existent file
_, err = g.ReadFileInWorkspace(context.Background(), "test1.txt", ReadFileInWorkspaceOptions{WorkspaceID: id})
if nf := (*NotFoundInWorkspaceError)(nil); !errors.As(err, &nf) {
Expand Down Expand Up @@ -226,6 +230,10 @@ func TestWriteReadAndDeleteFileFromWorkspaceS3(t *testing.T) {
t.Errorf("Unexpected file mod time: %v", fileInfo.ModTime)
}

if fileInfo.MimeType != "text/plain" {
t.Errorf("Unexpected file mime type: %s", fileInfo.MimeType)
}

// Ensure we get the error we expect when trying to read a non-existent file
_, err = g.ReadFileInWorkspace(context.Background(), "test1.txt", ReadFileInWorkspaceOptions{WorkspaceID: id})
if nf := (*NotFoundInWorkspaceError)(nil); !errors.As(err, &nf) {
Expand Down
Loading