@@ -25,17 +25,18 @@ func (w *Web) RedirectToConfig(c *gin.Context) {
2525 r , err := w .i .FindRepoOfUserByNamespaceName (ctx , u , namespace , name )
2626 if err != nil {
2727 w .log .Check (gb .GetZapLogLevel (err ), "Failed to get the repository." ).Write (zap .Error (err ))
28- gb . AbortWithError ( c , err )
28+ c . String ( http . StatusForbidden , "It has failed to get the repository." )
2929 return
3030 }
3131
3232 url , err := w .i .GetConfigRedirectURL (ctx , u , r )
3333 if err != nil {
3434 w .log .Check (gb .GetZapLogLevel (err ), "Failed to get the redirect URL for the configuration file." ).Write (zap .Error (err ))
35- gb . AbortWithError ( c , err )
35+ c . String ( http . StatusInternalServerError , "It has failed to get the redirect URL for the configuration file." )
3636 return
3737 }
3838
39+ w .log .Debug ("Redirect to the URL." , zap .String ("URL" , url ))
3940 c .Redirect (http .StatusMovedPermanently , url )
4041}
4142
@@ -54,16 +55,17 @@ func (w *Web) RedirectToNewConfig(c *gin.Context) {
5455 r , err := w .i .FindRepoOfUserByNamespaceName (ctx , u , namespace , name )
5556 if err != nil {
5657 w .log .Check (gb .GetZapLogLevel (err ), "Failed to get the repository." ).Write (zap .Error (err ))
57- gb . AbortWithError ( c , err )
58+ c . String ( http . StatusForbidden , "It has failed to get the repository." )
5859 return
5960 }
6061
6162 url , err := w .i .GetNewFileRedirectURL (ctx , u , r )
6263 if err != nil {
6364 w .log .Check (gb .GetZapLogLevel (err ), "Failed to get the redirect URL to create a new file." ).Write (zap .Error (err ))
64- gb . AbortWithError ( c , err )
65+ c . String ( http . StatusInternalServerError , "It has failed to get the redirect URL for the configuration file." )
6566 return
6667 }
6768
68- c .Redirect (http .StatusMovedPermanently , url )
69+ w .log .Debug ("Redirect to the URL." , zap .String ("URL" , url ))
70+ c .Redirect (http .StatusFound , url )
6971}
0 commit comments