File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ func ImageHandler(c echo.Context) error {
108
108
c .Response ().Header ().Set ("Access-Control-Allow-Origin" , "*" )
109
109
c .Response ().Header ().Set ("Access-Control-Allow-Methods" , "GET" )
110
110
111
- subpath := c . Param ( "* " )
111
+ subpath := strings . TrimPrefix ( c . Request (). RequestURI , "/image/ " )
112
112
113
113
splitter := strings .Index (subpath , "/" )
114
114
if splitter == - 1 {
@@ -236,7 +236,6 @@ func ImageHandler(c echo.Context) error {
236
236
}
237
237
req .Header .Set ("User-Agent" , useragent )
238
238
resp , err := client .Do (req )
239
-
240
239
if err != nil {
241
240
err := errors .Wrap (err , "Failed to fetch image" )
242
241
span .RecordError (err )
@@ -259,7 +258,9 @@ func ImageHandler(c echo.Context) error {
259
258
fetchSpan .End ()
260
259
261
260
if resp .StatusCode != 200 {
262
- err := errors .New ("Failed to fetch image" )
261
+ err := errors .New ("fetch image response code is not 200" )
262
+ span .SetAttributes (attribute .Int ("statusCode" , resp .StatusCode ))
263
+ span .SetAttributes (attribute .String ("body" , string (buf )))
263
264
span .RecordError (err )
264
265
return c .String (resp .StatusCode , err .Error ())
265
266
}
You can’t perform that action at this time.
0 commit comments