Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mime.type for yaml #991

Merged
merged 1 commit into from
Nov 16, 2022
Merged
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
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func main() {
var emptyBuckets []string
opts := cfg.ToFakeGcsOptions()
if cfg.Seed != "" {
addMimeTypes()
opts.InitialObjects, emptyBuckets = generateObjectsFromFiles(logger, cfg.Seed)
}

Expand All @@ -50,6 +51,16 @@ func main() {
<-ch
}

func addMimeTypes() {
mapping := map[string]string{
".yaml": "application/x-yaml",
".yml": "application/x-yaml",
}
for ext, typ := range mapping {
mime.AddExtensionType(ext, typ)
}
}

func generateObjectsFromFiles(logger *logrus.Logger, folder string) ([]fakestorage.Object, []string) {
var objects []fakestorage.Object
var emptyBuckets []string
Expand Down