Skip to content

Unable to set svg Content-Type #129

Description

@samdaltonmaag

Hi,

SVGs that I upload to my bucket are being served as text/plain. I suspect that the mime type detection has failed, so I'm trying to set it manually. Here's an example metadata object I use during upload:

      metadata: {
        'Content-Type': 'image/svg+xml'
      }

There doesn't seem to be any documentation on how to set the content type, so any help is appreciated.

Cheers

Activity

  1. stephenplusplus commented on Aug 22, 2014

    @stephenplusplus
    Contributor

    Just to confirm we're looking at the same thing, what version of gcloud-node are you running?

  2. silvolu commented on Aug 22, 2014

    @silvolu
    Contributor

    @samdaltonmaag there is an example in the storage regression test, the key should be contentType. You can find a complete description of Cloud Storage objects here.

  3. stephenplusplus commented on Aug 22, 2014

    @stephenplusplus
    Contributor

    Small thing: it's actually contentType, not ContentType.

    The bucket write functionality has changed since 0.3.0, so keep that in mind when looking at the repo's tests & docs.

    @silvolu Can we put out a 0.4.0 before the weekend?

  4. samdaltonmaag commented on Aug 22, 2014

    @samdaltonmaag
    Author

    Ah yes, it's working with that property name. I'm using 0.3.0.
    Appreciate the help.

  5. silvolu commented on Aug 22, 2014

    @silvolu
    Contributor

    @stephenplusplus yeah, but the way you write metadata hasn't changed ;-)

  6. added
    api: datastoreIssues related to the Datastore API.
    api: storageIssues related to the Cloud Storage API.
    and removed
    api: datastoreIssues related to the Datastore API.
    on Feb 2, 2015
  7. added this to the Storage Stable milestone on Feb 2, 2015
  8. adamreisnz commented on Jun 8, 2016

    @adamreisnz

    Could this be documented a bit clearer please? I reached this issue because I also couldn't find in the docs how to properly write the Content-Type meta data property, and tried to write it as:

    let stream = gcsFile.createWriteStream({
          metaData: {
            'Content-Type': file.mimetype
          }
        });

    Would be nice if this was documented, or a link to relevant documentation provided, somewhere here:

    https://googlecloudplatform.github.io/gcloud-node/#/docs/v0.35.0/storage/file?method=createWriteStream

  9. stephenplusplus commented on Jun 8, 2016

    @stephenplusplus
    Contributor

    We do show setting metadata in an example. Doesn't say much that you didn't see it, though! Could you contribute a PR with what you would have found helpful?

  10. adamreisnz commented on Jun 8, 2016

    @adamreisnz

    If you can send me the link to the page where the meta data is shown in an example, then yes I could add a link to that page in the documentation.

  11. stephenplusplus commented on Jun 8, 2016

    @stephenplusplus
    Contributor

    It's in the example for createWriteStream under "Uploading a File with Metadata"

  12. adamreisnz commented on Jun 8, 2016

    @adamreisnz

    Ah, there it is. Yes, a link in the table at the metadata property to that example would be great. I'd create a PR for this, but not sure what repository/files I should be looking at.

  13. 56 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions