Skip to content

Please remove Byte Order Mark returned from drive's export in 'text/plain' format #2404

@aryzing

Description

@aryzing
  1. Is this a client library issue or a product issue?

Client library issue

  1. Did someone already solve this?

no

  1. Do you have a support contract?

no

Environment details

  • OS: Linux 5.4 Ubuntu 18.04.5 LTS (Bionic Beaver)
  • Node.js version: 14.4.0
  • npm version: 6.14.5
  • googleapis version: 61.0.0

Steps to reproduce

  1. Make a create request, using for the body a string that does not begin with a Byte Order Mark and a mimeType of 'text/plain', such as
const requestBody = {
  name,
  parents: [folderId],
  mimeType: 'application/vnd.google-apps.document',
};
const media = {
  mimeType: 'text/plain',
  body: 'foo', // <--- This string doesn't have a BOM.
};
const data = await drive.files.create({
  requestBody,
  media,
  fields: 'id',
});
  1. Make an export request of the previously created file with the mimeType set to 'text/plain', such as
const { data } = await drive.files.export({
  fileId: id,
  mimeType: 'text/plain',
});
  1. The value data.content will contain a string that starts with a Byte Order Mark, "\uFFEFfoo", which was not in the original string.

Being the BOM an invisible character, it is increadibly hard to spot. This makes tests and application code harder to develop.

Metadata

Metadata

Assignees

Labels

externalThis issue is blocked on a bug with the actual product.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions