-
Notifications
You must be signed in to change notification settings - Fork 462
Feat(Storage): Enable full object checksum validation on JSON path #8825
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
053370b
69be82e
db306f4
6513fc4
2ac9aad
1e627f4
34f2f0b
4895c98
ddfc6e7
e24a1e3
d4dd640
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,10 +43,12 @@ public function upload($writeSize = null) | |
| return []; | ||
| } | ||
|
|
||
| $isFinalRequest = ($writeSize === null); | ||
|
|
||
| // find or create the resumeUri | ||
| $resumeUri = $this->getResumeUri(); | ||
|
|
||
| if ($writeSize) { | ||
| if ($writeSize !== null) { | ||
| $rangeEnd = $this->rangeStart + $writeSize - 1; | ||
| $data = $this->data->read($writeSize); | ||
| } else { | ||
|
|
@@ -62,6 +64,13 @@ public function upload($writeSize = null) | |
| 'Content-Range' => "bytes {$this->rangeStart}-$rangeEnd/*" | ||
| ]; | ||
|
|
||
| if ($isFinalRequest) { | ||
| $customHeaders = $this->requestOptions['restOptions']['headers'] ?? []; | ||
| if (isset($customHeaders['X-Goog-Hash'])) { | ||
| $headers['X-Goog-Hash'] = $customHeaders['X-Goog-Hash']; | ||
|
||
| } | ||
| } | ||
|
|
||
| $request = new Request( | ||
| 'PUT', | ||
| $resumeUri, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we are only setting this one header instead of supporting all custom headers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. The intent was to isolate the
X-Goog-Hashto the final chunk to avoid intermediate validation errors, but this implementation accidentally drops other custom headers. I will refactor this to merge all$customHeaderswhile specifically unsettingX-Goog-Hashonly on non-final chunks.