-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
WIP: Serve LFS/attachment with http.ServeContent to Support Range-Request #20480
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
WIP: Serve LFS/attachment with http.ServeContent to Support Range-Request #20480
Conversation
func (ct SniffedType) Mime() string { | ||
return strings.Split(ct.contentType, ";")[0] | ||
} | ||
|
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.
Note to self: this is a better version than I have in #20464, will incorporate there.
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.
we should use SplitN so go can skip split after first ; ... just some tiny optimization nits
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.
@silverwind I'm going to delete the mime stuff as it's unrelated to the pull topic! - so feel free to pick it for your pull :)
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.
sure, for reference, code was:
func (ct SniffedType) Mime() string {
return strings.Split(ct.contentType, ";")[0]
}
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.
If we are talking about micro-optimization, str[:strings.Index(str, ";")]
should be even faster than SplitN I think :)
Edit: Done, added it as GetMimeType
in #20484.
// Mime return the mime | ||
func (ct SniffedType) Mime() string { | ||
return strings.Split(ct.contentType, ";")[0] | ||
} | ||
|
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.
// Mime return the mime | |
func (ct SniffedType) Mime() string { | |
return strings.Split(ct.contentType, ";")[0] | |
} |
Delete as discussed, it's unused.
|
||
func setCommonHeaders(ctx *context.Context, name string, data interface{}) error { |
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.
Not sure this additional function is of any benefit. Cache header can be set like in #20484 via httpcache
module.
-> Make repository response support HTTP range request #24592 |
take #18448 and finish it ...