Skip to content

Bug in mimeType handling in get_file_contents #1168

@bluestonepim-frb

Description

@bluestonepim-frb

This line of code makes the get_file_contents tool produce corrupted output for most binary formats like pdf (application/pdf), .docx (application/vnd.openxmlformats-officedocument.wordprocessingml.document) etc. since the data is not returned as byte64 encoded string:

if strings.HasPrefix(contentType, "application") || strings.HasPrefix(contentType, "text") {

Here the corruption occurs:

Text: string(body),

Solution is to byte64 encode all binary formats, just like in this line:

Blob: base64.StdEncoding.EncodeToString(body),

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions