Skip to content

Bucket.upload: charset not appended on application/javascript contentType #320

Description

@beeant

I did console.log(metadata) on Bucket.upload API. and charset=utf-8 doesn't seem to be appended for application/javascript.

https://github.com/GoogleCloudPlatform/gcloud-node/blob/d36802f03267a4c890a2f5203a8a46a452b329cf/lib/storage/bucket.js#L418

How about using https://github.com/jshttp/mime-types instead of https://github.com/broofa/node-mime?

node-mime doesn't seem to return any charset on application/javascript, but mime-types does.

Activity

  1. stephenplusplus commented on Dec 4, 2014

    @stephenplusplus
    Contributor

    mime-types looks good to me. 👍

  2. stephenplusplus commented on Dec 4, 2014

    @stephenplusplus
    Contributor

    I'll wait a little bit to see how jshttp/mime-types#15 shakes out. In the meantime, you are free to use mime-types in your app, then set its value on the metadata object passed to .upload:

    bucket.upload("file.js", { contentType: "result from mimetypes" }, function (err, file) {})
  3. beeant commented on Dec 4, 2014

    @beeant
    Author

    Thank you for your reply.
    Thank you for the suggestion too, and yes, that's what I'm doing right now.
    I'll be keeping track for the update and remove the unnecessary parts of mime-types codes in my app after the update.

  4. added a commit that references this issue on Dec 5, 2014
    3484e3b
  5. added a commit that references this issue on Dec 8, 2014
    dc4bf20
  6. added 2 commits that reference this issue on Dec 8, 2014
    24f165e
    b5211a7
  7. added
    api: storageIssues related to the Cloud Storage API.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Feb 2, 2015
  8. added this to the Storage Stable milestone on Feb 2, 2015
  9. 41 remaining items

  10. added a commit that references this issue on Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions