Convert context value to string securely

This commit is contained in:
DarthSim
2020-02-05 17:00:31 +06:00
parent 0f00870708
commit 65579a5770
2 changed files with 6 additions and 3 deletions

View File

@@ -210,9 +210,11 @@ func getImageData(ctx context.Context) *imageData {
} }
func getCacheControlHeader(ctx context.Context) string { func getCacheControlHeader(ctx context.Context) string {
return ctx.Value(cacheControlHeaderCtxKey).(string) str, _ := ctx.Value(cacheControlHeaderCtxKey).(string)
return str
} }
func getExpiresHeader(ctx context.Context) string { func getExpiresHeader(ctx context.Context) string {
return ctx.Value(expiresHeaderCtxKey).(string) str, _ := ctx.Value(expiresHeaderCtxKey).(string)
return str
} }

View File

@@ -1046,7 +1046,8 @@ func parsePath(ctx context.Context, r *http.Request) (context.Context, error) {
} }
func getImageURL(ctx context.Context) string { func getImageURL(ctx context.Context) string {
return ctx.Value(imageURLCtxKey).(string) str, _ := ctx.Value(imageURLCtxKey).(string)
return str
} }
func getProcessingOptions(ctx context.Context) *processingOptions { func getProcessingOptions(ctx context.Context) *processingOptions {