Skip to content

Commit a6f6d69

Browse files
committed
feat: add to workspace fileinfo
1 parent 7efb340 commit a6f6d69

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

workspace.go

+1
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,5 @@ type FileInfo struct {
252252
Name string
253253
Size int64
254254
ModTime time.Time
255+
MimeType string
255256
}

workspace_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ func TestWriteReadAndDeleteFileFromWorkspace(t *testing.T) {
7575
t.Errorf("Unexpected file mod time: %v", fileInfo.ModTime)
7676
}
7777

78+
if fileInfo.MimeType != "text/plain" {
79+
t.Errorf("Unexpected file mime type: %s", fileInfo.MimeType)
80+
}
81+
7882
// Ensure we get the error we expect when trying to read a non-existent file
7983
_, err = g.ReadFileInWorkspace(context.Background(), "test1.txt", ReadFileInWorkspaceOptions{WorkspaceID: id})
8084
if nf := (*NotFoundInWorkspaceError)(nil); !errors.As(err, &nf) {
@@ -226,6 +230,10 @@ func TestWriteReadAndDeleteFileFromWorkspaceS3(t *testing.T) {
226230
t.Errorf("Unexpected file mod time: %v", fileInfo.ModTime)
227231
}
228232

233+
if fileInfo.MimeType != "text/plain" {
234+
t.Errorf("Unexpected file mime type: %s", fileInfo.MimeType)
235+
}
236+
229237
// Ensure we get the error we expect when trying to read a non-existent file
230238
_, err = g.ReadFileInWorkspace(context.Background(), "test1.txt", ReadFileInWorkspaceOptions{WorkspaceID: id})
231239
if nf := (*NotFoundInWorkspaceError)(nil); !errors.As(err, &nf) {

0 commit comments

Comments
 (0)