Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: add charset=utf-8 for text content resources (#3608)

Zeng19984f4fe9b26b98
diff --git a/server/router/api/v1/resource_service.go b/server/router/api/v1/resource_service.go
index 3004cf243..19e6c6f8a 100644
--- a/server/router/api/v1/resource_service.go
+++ b/server/router/api/v1/resource_service.go
@@ -210,8 +210,13 @@ func (s *APIV1Service) GetResourceBinary(ctx context.Context, request *v1pb.GetR
}
}
+ contentType := resource.Type
+ if strings.HasPrefix(contentType, "text/") {
+ contentType += "; charset=utf-8"
+ }
+
httpBody := &httpbody.HttpBody{
- ContentType: resource.Type,
+ ContentType: contentType,
Data: blob,
}
return httpBody, nil