Skip to content

Can't add files with names which contain "/" and "." and "~" in object name #1340

Description

@Gr1g0ry

When I use object names with dot, slash and tilde together I receive error.

Next is mocha test:

"use strict";
var config = require('config');
var gcloud = require('gcloud');
var gcs = gcloud.storage({
  keyFilename: config.gcloud.keyFilename,
  projectId:   config.gcloud.projectId
});
var myBucket = gcs.bucket(config.buckets.serviceTags.name);

describe('Zero test', function () {
  it('should save file without errors', function (done) {
    myBucket.file('type~user/user.00000000-0000-0000-0000-000000000000')
      .save('some text', {metadata: {contentType: 'text/plain' }}, function (err) { done(err); });
  });
});

returns error:

 Error: Not Found
  at _stream_readable.js:908:16

Activity

  1. stephenplusplus commented on May 25, 2016

    @stephenplusplus
    Contributor

    I couldn't reproduce with the following script:

    'use strict'
    
    var gcloud = require('gcloud')
    var gcs = gcloud.storage()
    var bucket = gcs.bucket(process.env.BUCKET)
    var file = bucket.file('type~user/user.00000000-0000-0000-0000-000000000000')
    
    file.save('test', console.log)

    Is there any chance the error is coming from a separate call? Maybe in a before hook?

  2. Gr1g0ry commented on May 25, 2016

    @Gr1g0ry
    Author

    I'm sure that problem in test (not in before). I have the same problem also in node

    "use strict";
    var config = require('config');
    var gcloud = require('gcloud');
    var gcs = gcloud.storage({
      keyFilename: config.gcloud.keyFilename,
      projectId:   config.gcloud.projectId
    });
    var myBucket = gcs.bucket(config.buckets.serviceTags.name);
    var file = myBucket.file('type~user/user.00000000-0000-0000-0000-000000000000');
    
    file.save('some text', {metadata: {contentType: 'text/plain' }}, function (err) { if (err) {throw err; } });

    returns

    Error: Not Found
        at Request._callback (/home/gr1g0ry/_prj/_gmap/_code/node_gcs/demo/node_modules/gcloud/node_modules/gcs-resumable-upload/index.js:257:25)
        at Request.self.callback (/home/gr1g0ry/_prj/_gmap/_code/node_gcs/demo/node_modules/gcloud/node_modules/request/request.js:200:22)
        at Request.emit (events.js:110:17)
        at Request.<anonymous> (/home/gr1g0ry/_prj/_gmap/_code/node_gcs/demo/node_modules/gcloud/node_modules/request/request.js:1067:10)
        at Request.emit (events.js:129:20)
        at IncomingMessage.<anonymous> (/home/gr1g0ry/_prj/_gmap/_code/node_gcs/demo/node_modules/gcloud/node_modules/request/request.js:988:12)
        at IncomingMessage.emit (events.js:129:20)
        at _stream_readable.js:908:16
        at process._tickCallback (node.js:355:11)
    
    
  3. stephenplusplus commented on May 25, 2016

    @stephenplusplus
    Contributor

    I can reproduce when the bucket doesn't exist. Could you check that the bucket exists?

    bucket.exists(console.log)
  4. Gr1g0ry commented on May 25, 2016

    @Gr1g0ry
    Author

    Yes bucket exists. For reproducing you need some of your bucket and correspondent key.json file.
    I'm sure that problem in name because next code is successful:

    "use strict";
    var config = require('config');
    var gcloud = require('gcloud');
    var gcs = gcloud.storage({
      keyFilename: config.gcloud.keyFilename,
      projectId:   config.gcloud.projectId
    });
    var myBucket = gcs.bucket(config.buckets.serviceTags.name);
    var file = myBucket.file('nice/name');
    
    file.save('some text', {metadata: {contentType: 'text/plain' }}, function (err) { if (err) {throw err; } });

    The difference between them only in filename

  5. stephenplusplus commented on May 25, 2016

    @stephenplusplus
    Contributor

    What OS are you running?

  6. Gr1g0ry commented on May 25, 2016

    @Gr1g0ry
    Author

    Ubuntu 14.04

  7. stephenplusplus commented on May 25, 2016

    @stephenplusplus
    Contributor

    Can you try:

    file.save('test', {
      resumable: false,
      metadata: {
        contentType: 'text/plain'
      }
    }, console.log)
  8. Gr1g0ry commented on May 25, 2016

    @Gr1g0ry
    Author

    Ok. The problem was solved. Thanks.

  9. Gr1g0ry commented on May 25, 2016

    @Gr1g0ry
    Author

    Should I close issue?

  10. stephenplusplus commented on May 25, 2016

    @stephenplusplus
    Contributor

    Glad it was resolved. Let's keep it open for a little longer. I want to dig into this later to figure out exactly what might have happened.

  11. Gr1g0ry commented on May 25, 2016

    @Gr1g0ry
    Author

    Ok.

  12. stephenplusplus commented on Jun 27, 2016

    @stephenplusplus
    Contributor

    I think I've found a resolution. That was an error from gcs-resumable-upload, the module we use to handle resumable file uploads. In the beginning part of trying to resume an upload, it asks the server how much data it already has, so it knows at what point in the file it should start sending data from. The response to that was a 404, because of a caching issue. To track state, that module stores a piece of data in a config file. The file you were uploading must have been uploaded previously, and either it failed or it was improperly cleaned up after the file was uploaded.

    The fix I just released will automatically recognize that scenario (caching error), erase the old entry from the cache, and start a new resumable upload.

    Thanks for catching this, it will hopefully save a lot of confusion for users going forward!

  13. added a commit that references this issue on Jul 23, 2025
  14. added a commit that references this issue on Feb 5, 2026
  15. added a commit that references this issue on Feb 17, 2026
  16. added a commit that references this issue on Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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