-
Notifications
You must be signed in to change notification settings - Fork 110
Consume URI in PUT response for GitHub-owned storage for GEI #1371
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?
Conversation
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.
Pull Request Overview
This PR updates the multipart upload flow to consume the JSON body returned by the final PUT "complete" request and use its uri
field instead of synthesizing the GEI URI.
- Tests now mock and assert against the full JSON response, including the
uri
property. ArchiveUploader
is refactored to parse the JSON response inCompleteUpload
and return theuri
instead of extracting the GUID from the query string.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
ArchiveUploadersTests.cs | Adds JObject response mocks and updates assertions to use the returned uri . |
ArchiveUploader.cs | Removes manual GUID parsing, parses JSON in CompleteUpload , and returns the uri . |
Comments suppressed due to low confidence (2)
src/Octoshift/Services/ArchiveUploader.cs:81
- [nitpick] Returning the GEI URI as a string may lead to formatting issues downstream. Consider having
UploadMultipart
return aUri
object directly for stronger typing.
return geiUri.ToString();
src/Octoshift/Services/ArchiveUploader.cs:136
- Parsing and immediately using the
uri
field without validation may throw on unexpected responses. Consider checking for missing or invaliduri
and logging a clearer error if parsing fails.
var responseData = JObject.Parse(response);
var completeUploadResponse = new JObject | ||
{ | ||
["guid"] = guid, | ||
["node_id"] = "global-relay-id", | ||
["name"] = archiveName, | ||
["size"] = largeContent.Length, | ||
["uri"] = geiUri, | ||
["created_at"] = "2025-06-23T17:13:02.818-07:00" | ||
}; |
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.
The completeUploadResponse
initialization is duplicated across multiple tests. Consider extracting it into a common helper or fixture to reduce repetition.
var completeUploadResponse = new JObject | |
{ | |
["guid"] = guid, | |
["node_id"] = "global-relay-id", | |
["name"] = archiveName, | |
["size"] = largeContent.Length, | |
["uri"] = geiUri, | |
["created_at"] = "2025-06-23T17:13:02.818-07:00" | |
}; | |
var completeUploadResponse = CreateCompleteUploadResponse(guid, archiveName, largeContent.Length, geiUri); |
Copilot uses AI. Check for mistakes.
Unit Test Results 1 files 1 suites 20s ⏱️ Results for commit ff927dd. ♻️ This comment has been updated with latest results. |
Closes https://github.ghe.com/github/octoshift/issues/10765!
This PR consumes the new JSON response from the PUT "complete" request for the multipart upload flow when uploading archives to GitHub-owned storage for GEI!
This is an example of a response from the PUT response:
With the changes in this PR, the JSON body ☝️ is consumed, and the GEI URI doesn't need to be interpolated anymore:
gh-gei/src/Octoshift/Services/ArchiveUploader.cs
Lines 82 to 85 in f9ee191
Here's an example of these changes at work:
ThirdPartyNotices.txt
(if applicable)