mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 08:48:32 +02:00
fix: add nil guard before entrypoint retrieval; move config from types/
This commit is contained in:
@@ -74,6 +74,9 @@ func FavIcon(c *gin.Context) {
|
||||
func GetFavIconFromAlias(ctx context.Context, alias string, variant icons.Variant) (iconfetch.Result, error) {
|
||||
// try with route.Icon
|
||||
ep := entrypoint.FromCtx(ctx)
|
||||
if ep == nil { // impossible, but just in case
|
||||
return iconfetch.FetchResultWithErrorf(http.StatusInternalServerError, "entrypoint not initialized")
|
||||
}
|
||||
r, ok := ep.HTTPRoutes().Get(alias)
|
||||
if !ok {
|
||||
return iconfetch.FetchResultWithErrorf(http.StatusNotFound, "route not found")
|
||||
|
||||
Reference in New Issue
Block a user