GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — options.public to storage/File.createWriteStream doesn't make uploaded files public · Issue #1566 · googleapis/google-cloud-node

options.public to storage/File.createWriteStream doesn't make uploaded files public #1566

New issue
Copy link
New issue
Copy link
Closed
Closed
options.public to storage/File.createWriteStream doesn't make uploaded files public#1566
Copy link
Assignees
stephenplusplus
Labels
api: storageIssues related to the Cloud Storage API.

Description

@aknuds1
aknuds1
opened on Sep 6, 2016
Issue body actions

According to API docs, storage/File.createWriteStream should take a boolean option public that makes the uploaded file publicly readable. However, in my experience this isn't the case.

I create the stream like this:

let cloudFileStream = cloudFile.createWriteStream({
  public: true,
  resumable: false,
})

And still, I have to call cloudFile.makePublic after the upload has finished, because otherwise the file is only accessible to the owner:

cloudFileStream
  .on('finish', () => {
    cloudFile.makePublic()
  })

Environment details

  • OS: OS X El Capitan
  • Node.js version: 6.4.0
  • npm version: 3.10.6
  • google-cloud-node version: 0.39.0
Reacted by Michael Prentice

Activity

Next
  1. stephenplusplus commented on Sep 6, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 6, 2016
    Contributor
    More actions

    Setting public: true will set the object's predefinedAcl to publicRead. Calling file.makePublic() will grant the READER role to allUsers. Do you have any existing rules that might be trumping the predefinedAcl?

    To test, I created a new bucket and new file, so that no existing configuration could get in the way.

    The bucket's permissions:
    screen shot 2016-09-06 at 9 05 39 am

    The bucket's default object permissions:
    screen shot 2016-09-06 at 9 05 58 am

    The bucket's contents:
    screen shot 2016-09-06 at 9 06 25 am

    The file's permissions:
    screen shot 2016-09-06 at 9 06 46 am

  2. stephenplusplus
    added
    api: storageIssues related to the Cloud Storage API.
    on Sep 6, 2016
  3. aknuds1 commented on Sep 6, 2016

    @aknuds1
    aknuds1
    on Sep 6, 2016
    ContributorAuthor
    More actions

    @stephenplusplus So, the only issue here should be an existing rule trumping predefinedAcl? Am not aware of having any such rule, but I'll look.

  4. aknuds1 commented on Sep 6, 2016

    @aknuds1
    aknuds1
    on Sep 6, 2016
    ContributorAuthor
    More actions

    @stephenplusplus How did you add the allusers: Reader bit? Does this correspond to predefinedAcl: publicRead?

    Reacted by Michael Prentice
  5. stephenplusplus commented on Sep 6, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 6, 2016
    Contributor
    More actions

    Yes, that came from setting predefinedAcl: publicRead.

    @jgeewax, am I giving out correct information?

  6. aknuds1 commented on Sep 6, 2016

    @aknuds1
    aknuds1
    on Sep 6, 2016
    ContributorAuthor
    More actions

    @stephenplusplus OK, so that should mean that predefinedAcl: publicRead is equivalent to calling file.makePublic() does it not? I end up with the same in my file permissions, by calling file.makePublic().

    Reacted by Michael Prentice
  7. Splaktar commented on Sep 18, 2016

    @Splaktar
    Splaktar
    on Sep 18, 2016
    Contributor
    More actions

    We saw this same issue lately as well. We used the CLI (since the UI didn't have this feature) to change the predefinedAcl on the whole bucket since we didn't want to call file.makePublic() on every file.

    It would be ideal if the option worked as expected and make the file public.

  8. stephenplusplus commented on Sep 19, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 19, 2016
    Contributor
    More actions

    I would like to resolve this the right way once and for all! I'm going to need some help from @jgeewax, @omaray, maybe @Capstan. Simply put, what needs to be in an upload request body that makes the file being uploaded public? Thanks!

    Reacted by Arve Knudsen
  9. aknuds1 commented on Sep 19, 2016

    @aknuds1
    aknuds1
    on Sep 19, 2016
    ContributorAuthor
    More actions

    @stephenplusplus Come to think of it, how would you write a test for this issue? Apparently it's not solved, so seems as if you lack a test for this functionality.

  10. stephenplusplus commented on Sep 19, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 19, 2016
    Contributor
    More actions

    We do: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/35573c31e834c841b99ae73f6cf5e647b76ae7cc/packages/storage/system-test/storage.js#L424 -- but if we're not doing it the right way, we'll need to rewrite the test.

    Reacted by Arve Knudsen
  11. aknuds1 commented on Sep 19, 2016

    @aknuds1
    aknuds1
    on Sep 19, 2016
    ContributorAuthor
    More actions

    @stephenplusplus I guess there's some sort of false positive there, looks that way at least.

  12. stephenplusplus commented on Sep 19, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 19, 2016
    Contributor
    More actions

    Indeed, looking forward to fixing this :)

  13. Capstan commented on Sep 19, 2016

    @Capstan
    Capstan
    on Sep 19, 2016
    More actions

    @stephenplusplus When you upload an object, you can specify either a predefined ACL or a fully-enumerated ACL, and you get errors if you have both. If you don't want to bother writing client logic, you could just always turn public: true to the predefined ACL but then also use whatever client-provided ACL and let the service return the error that you cannot cross the streams. Seems like a bad idea to have the client specify one ACL that doesn't set it to public read and another in the same request that does. Or perhaps I'm misunderstanding and there's no additional user-provided ACL?

  14. stephenplusplus commented on Sep 19, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 19, 2016
    Contributor
    More actions

    We're not really running into conflicting ACL specifications during the upload here. In the simplest case, a user might want to upload a file and make it public in one line, and it would look like this:

    bucket.upload('./localfile.txt', { public: true }, function(err) {})

    That would send POST https://.../o?name=localfile.txt&predefinedAcl=publicRead.

    Is this what our library should do, or is there more to it?

  15. Capstan commented on Sep 19, 2016

    @Capstan
    Capstan
    on Sep 19, 2016
    More actions

    I presume there's no body to the POST if resumable and it also contains an uploadType URL parameter that's either media or resumable? If so, then, that's exactly what it should do. Does the ACL you get back from such an object not list allUsers: READER?

  16. 1 remaining item

  17. stephenplusplus commented on Oct 3, 2016

    @stephenplusplus
    stephenplusplus
    on Oct 3, 2016
    Contributor
    More actions

    It seems like we're doing this right as far as the API is concerned. If I'm missing something, we'll re-open and get back to work. Thanks!

  18. stephenplusplus
    closed this as completedon Oct 3, 2016
  19. Splaktar commented on Oct 12, 2016

    @Splaktar
    Splaktar
    on Oct 12, 2016
    Contributor
    More actions

    Sorry, I ran out of bandwidth to debug this and then Hurricane Matthew hit. We were able to work around it for now. Thanks.

  20. JustinBeckwith
    assigned
    stephenplusplus
    on Feb 1, 2021
  21. sofisl
    added a commit that references this issue on Feb 3, 2026

    chore: update npmjs.org to npmjs.com (#1566)

    0e64905
  22. sofisl
    added a commit that references this issue on Feb 25, 2026

    test: conformance testing for retries (#1566)

    9757193
  23. GautamSharda
    added 2 commits that reference this issue on Mar 11, 2026

    fix: fixes for dynamic routing and streaming descriptors (#1566)

    f3fce69

    chore(main): release 3.0.0 (#1556)

    0d3d3e5
  24. sofisl
    added a commit that references this issue on Mar 17, 2026

    chore(deps): update dependency @types/node to ^20.12.4 (#1566)

    fa659b2
  25. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    test: conformance testing for retries (googleapis#1566)

    055f2e7
  26. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    feat: Add the MetricsCollector for client side metrics (#1566)

    a448a89

    feat: Add the MetricsCollector for client side metrics (#1566)

    f9ad230
  27. feywind
    added a commit that references this issue on Mar 27, 2026

    chore(main): release 3.0.0 (#1556)

    4cb9ab8
  28. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    feat: Add the MetricsCollector for client side metrics (#1566)

    d258098
  29. thiyaguk09
    added a commit that references this issue on May 5, 2026

    feat: Add the MetricsCollector for client side metrics (googleapis#1566)

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

Metadata

Metadata

Assignees

  • @stephenplusplus
    stephenplusplus

Labels

api: storageIssues related to the Cloud Storage API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.