-
Notifications
You must be signed in to change notification settings - Fork 482
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
feat(handler, s3store): implement ServerDataStore for direct content serving #1208
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -1047,6 +1047,17 @@ func (handler *UnroutedHandler) GetFile(w http.ResponseWriter, r *http.Request) | |
return | ||
} | ||
|
||
// If the data store implements ContentServerDataStore, use the ServableUpload interface | ||
if handler.composer.UsesContentServer { | ||
servableUpload := handler.composer.ContentServer.AsServableUpload(upload) | ||
err = servableUpload.ServeContent(c, w, r) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if the handler should set the Content-Length, Content-Type and Content-Disposition before passing it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you decide? |
||
if err != nil { | ||
handler.sendError(c, err) | ||
} | ||
return | ||
} | ||
|
||
// Fall back to the existing GetReader implementation if ContentServerDataStore is not implemented | ||
contentType, contentDisposition := filterContentType(info) | ||
resp := HTTPResponse{ | ||
StatusCode: http.StatusOK, | ||
|
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.
This function needs proper documentation. That's best done when we have agreed on what the handler does and does not.
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.
lmk what/when you want docs on this.