这是indexloc提供的服务,不要输入任何密码
Skip to content

downloadManyFiles can't write to tempdir outside of cwd #2660

@faultyserver

Description

@faultyserver

Please make sure you have searched for information in the following guides.

A screenshot that you have tested with "Try this API".

Not related to the API, just the JS implementation of TransferManager.downloadManyFiles.

Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.

https://gist.github.com/faultyserver/baed2362e93fb2eb8feda06ad2b77813

A step-by-step description of how to reproduce the issue, based on the linked reproduction.

The above gist can be run just by adding a valid Storage reference at the top. In general, the process is:

  1. Make a temporary directory, like path.join(os.tmpdir(), 'some-namespace')
  2. Call downloadManyFiles with passthroughOptions.destination as that tempdir
  3. Run the code, observe a rejected promise with the TRAVERSAL_OUTSIDE_BASE_DESTINATION error message.

A clear and concise description of what the bug is, and what you expected to happen.

downloadManyFiles doesn't allow writing to a temporary directory.

I would expect to be able to write a large directory of content into a new directory that I created, especially a temporary directory, to avoid having to write into the current working directory first. Additional use cases this is affecting for me are working in a monorepo where a command may write to a separate cache folder in the same repo that is specified as an absolute path rather than relative from the root of the repository.

A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **

This was added in a recent version (~2 weeks ago) in this PR and is now preventing downloads to anywhere other than the current working directory, without an option to override or opt out of the behavior for knowably-safe operations, like writing to a temporary directory.

For scripts that are just downloading data to use in other processing, it's common to write to a temporary directory to avoid populating randomly into a project's repository or somewhere persistent and visible to the user.

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/nodejs-storage API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions