nodejs-storage
nodejs-storage copied to clipboard
File.publicUrl() unexpectedly escapes forward slashes in > 7.6.0
Summary
Forward slashes are escaped to "%2F" in File.publicUrl() for files that are > 1 level deep.
Unexpected result: "https://storage.googleapis.com/bucketId/path%2Fto%2Ffile" Expected result: "https://storage.googleapis.com/bucketId/path/to/file"
The expected result is given before <= 6.5.4. So this issue looks like a regression.
Environment details
@google-cloud/storageversion: > 7.6.0
Steps to reproduce
- Run the example code. This can also be reproduced in npm's runkit. (https://npm.runkit.com/%40google-cloud%2Fstorage)
var Storage = require("@google-cloud/storage")
var storage = new Storage.Storage();
var bucket = storage.bucket('bucketId');
var file = bucket.file('path/to/file');
var url = file.publicUrl();
Unexpected result: "https://storage.googleapis.com/bucketId/path%2Fto%2Ffile" Expected result: "https://storage.googleapis.com/bucketId/path/to/file"
Additional info
There was an identical bug in the python library. https://github.com/googleapis/google-cloud-python/issues/3809