Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: file.createReadStream: only send data when non-error #776

Merged

Conversation

stephenplusplus
Copy link
Contributor

Fixes #772

When we make an HTTP request, we immediately get back the response headers. This PR uses those to detect an error via the status code. Previously, we detected the error after the data had been consumed and pushed to the user's stream.

This affected file.createReadStream(), when we would GET https://storage.googleapis.com/_bucket_/_object_ a file that didn't exist.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 31, 2015
@stephenplusplus stephenplusplus added the api: storage Issues related to the Cloud Storage API. label Jul 31, 2015
callmehiphop added a commit that referenced this pull request Jul 31, 2015
…errors

storage: file.createReadStream: only send data when non-error
@callmehiphop callmehiphop merged commit a5e330c into googleapis:master Jul 31, 2015
@callmehiphop
Copy link
Contributor

Gracias!

sofisl pushed a commit that referenced this pull request Nov 17, 2022
* chore(main): release 3.5.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this pull request Jan 17, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@google-cloud/storage](https://github.com/googleapis/nodejs-storage) | devDependencies | major | [`^4.0.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/@google-cloud%2fstorage/4.7.0/5.0.0) |

---

### Release Notes

<details>
<summary>googleapis/nodejs-storage</summary>

### [`v5.0.0`](https://github.com/googleapis/nodejs-storage/blob/master/CHANGELOG.md#&#8203;500-httpswwwgithubcomgoogleapisnodejs-storagecomparev470v500-2020-05-13)

[Compare Source](https://github.com/googleapis/nodejs-storage/compare/v4.7.0...v5.0.0)

##### ⚠ BREAKING CHANGES

-   automatically detect contentType if not provided ([#&#8203;1190](https://github.com/googleapis/nodejs-storage/issues/1190))
-   drop keepAcl parameter in file copy ([#&#8203;1166](https://github.com/googleapis/nodejs-storage/issues/1166))
-   drop support for node.js 8.x

##### Features

-   automatically detect contentType if not provided ([#&#8203;1190](https://www.github.com/googleapis/nodejs-storage/issues/1190)) ([b31ba4a](https://www.github.com/googleapis/nodejs-storage/commit/b31ba4a11399b57538ddf0d6ca2e10b2aa3fbc3a))
-   enable bytes read tracking ([#&#8203;1074](https://www.github.com/googleapis/nodejs-storage/issues/1074)) ([0776a04](https://www.github.com/googleapis/nodejs-storage/commit/0776a044f3b2149b485e114369e952688df75645))

##### Bug Fixes

-   **bucket:** Only disable resumable uploads for bucket.upload (fixes [#&#8203;1133](https://www.github.com/googleapis/nodejs-storage/issues/1133)) ([#&#8203;1135](https://www.github.com/googleapis/nodejs-storage/issues/1135)) ([2c20148](https://www.github.com/googleapis/nodejs-storage/commit/2c201486b7b2d3146846ac96c877a904c4a674b0)), closes [/github.com/googleapis/nodejs-storage/pull/1135#issuecomment-620070038](https://www.github.com/googleapis//github.com/googleapis/nodejs-storage/pull/1135/issues/issuecomment-620070038)
-   add whitespace to generateV4SignedPolicy ([#&#8203;1136](https://www.github.com/googleapis/nodejs-storage/issues/1136)) ([dcee78b](https://www.github.com/googleapis/nodejs-storage/commit/dcee78b98da23b02fe7d2f13a9270546bc07bba8))
-   apache license URL ([#&#8203;468](https://www.github.com/googleapis/nodejs-storage/issues/468)) ([#&#8203;1151](https://www.github.com/googleapis/nodejs-storage/issues/1151)) ([e8116d3](https://www.github.com/googleapis/nodejs-storage/commit/e8116d3c6fa7412858692e67745b514eef78850e))
-   Point to team in correct org ([#&#8203;1185](https://www.github.com/googleapis/nodejs-storage/issues/1185)) ([0bb1909](https://www.github.com/googleapis/nodejs-storage/commit/0bb19098013acf71cc3842f78ff333a8e356331a))
-   **deps:** update dependency [@&#8203;google-cloud/common](https://github.com/google-cloud/common) to v3 ([#&#8203;1134](https://www.github.com/googleapis/nodejs-storage/issues/1134)) ([774ac5c](https://www.github.com/googleapis/nodejs-storage/commit/774ac5c75f02238418cc8ed7242297ea573ca9cb))
-   **deps:** update dependency [@&#8203;google-cloud/paginator](https://github.com/google-cloud/paginator) to v3 ([#&#8203;1131](https://www.github.com/googleapis/nodejs-storage/issues/1131)) ([c1614d9](https://www.github.com/googleapis/nodejs-storage/commit/c1614d98e3047db379e09299b1014e80d73ed52f))
-   **deps:** update dependency [@&#8203;google-cloud/promisify](https://github.com/google-cloud/promisify) to v2 ([#&#8203;1127](https://www.github.com/googleapis/nodejs-storage/issues/1127)) ([06624a5](https://www.github.com/googleapis/nodejs-storage/commit/06624a534cd1fdbc38455eee8d89f9f60ba75758))
-   **deps:** update dependency uuid to v8 ([#&#8203;1170](https://www.github.com/googleapis/nodejs-storage/issues/1170)) ([6a98d64](https://www.github.com/googleapis/nodejs-storage/commit/6a98d64831baf1ca1ec2f03ecc4914745cba1c86))
-   **deps:** update gcs-resumable-upload, remove gitnpm usage ([#&#8203;1186](https://www.github.com/googleapis/nodejs-storage/issues/1186)) ([c78c9cd](https://www.github.com/googleapis/nodejs-storage/commit/c78c9cde49dccb2fcd4ce10e4e9f8299d65f6838))
-   **v4-policy:** encode special characters ([#&#8203;1169](https://www.github.com/googleapis/nodejs-storage/issues/1169)) ([6e48539](https://www.github.com/googleapis/nodejs-storage/commit/6e48539d76ca27e6f4c6cf2ac0872970f7391fed))
-   sync to [googleapis/conformance-tests@`fa559a1`](https://github.com/googleapis/conformance-tests/commit/fa559a1) ([#&#8203;1167](https://www.github.com/googleapis/nodejs-storage/issues/1167)) ([5500446](https://www.github.com/googleapis/nodejs-storage/commit/550044619d2f17a1977c83bce5df915c6dc9578c)), closes [#&#8203;1168](https://www.github.com/googleapis/nodejs-storage/issues/1168)

##### Miscellaneous Chores

-   drop keepAcl parameter in file copy ([#&#8203;1166](https://www.github.com/googleapis/nodejs-storage/issues/1166)) ([5a4044a](https://www.github.com/googleapis/nodejs-storage/commit/5a4044a8ba13f248fc4f791248f797eb0f1f3c16))

##### Build System

-   drop support for node.js 8.x ([b80c025](https://www.github.com/googleapis/nodejs-storage/commit/b80c025f106052fd25554c64314b3b3520e829b5))

</details>

---

### Renovate configuration

:date: **Schedule**: "after 9am and before 3pm" (UTC).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-vision).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants