|
@@ -87,14 +87,14 @@ func (h *Handler) addDirLink(next nextHTTP) nextHTTP {
|
|
|
// application/jose+json.
|
|
// application/jose+json.
|
|
|
func (h *Handler) verifyContentType(next nextHTTP) nextHTTP {
|
|
func (h *Handler) verifyContentType(next nextHTTP) nextHTTP {
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
|
- var (
|
|
|
|
|
- expected []string
|
|
|
|
|
- provName string
|
|
|
|
|
- )
|
|
|
|
|
- if p, err := provisionerFromContext(r.Context()); err == nil && p != nil {
|
|
|
|
|
- provName = p.GetName()
|
|
|
|
|
- }
|
|
|
|
|
- u := url.URL{Path: h.linker.GetUnescapedPathSuffix(CertificateLinkType, provName, "")}
|
|
|
|
|
|
|
+ var expected []string
|
|
|
|
|
+ p, err := provisionerFromContext(r.Context())
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ api.WriteError(w, err)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ u := url.URL{Path: h.linker.GetUnescapedPathSuffix(CertificateLinkType, p.GetName(), "")}
|
|
|
if strings.Contains(r.URL.String(), u.EscapedPath()) {
|
|
if strings.Contains(r.URL.String(), u.EscapedPath()) {
|
|
|
// GET /certificate requests allow a greater range of content types.
|
|
// GET /certificate requests allow a greater range of content types.
|
|
|
expected = []string{"application/jose+json", "application/pkix-cert", "application/pkcs7-mime"}
|
|
expected = []string{"application/jose+json", "application/pkix-cert", "application/pkcs7-mime"}
|