From a6f6d69c2b4dddddab76c783c7016aadd11f7d60 Mon Sep 17 00:00:00 2001 From: Thorsten Klein Date: Wed, 20 Nov 2024 19:54:50 +0100 Subject: [PATCH] feat: add to workspace fileinfo --- workspace.go | 1 + workspace_test.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/workspace.go b/workspace.go index aa4f175..a1214b8 100644 --- a/workspace.go +++ b/workspace.go @@ -252,4 +252,5 @@ type FileInfo struct { Name string Size int64 ModTime time.Time + MimeType string } diff --git a/workspace_test.go b/workspace_test.go index df51a86..d2d5706 100644 --- a/workspace_test.go +++ b/workspace_test.go @@ -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) { @@ -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) {