(ctx *gin.Context)
| 631 | } |
| 632 | |
| 633 | func (tc *TemplateController) SitemapPage(ctx *gin.Context) { |
| 634 | if tc.checkPrivateMode(ctx) { |
| 635 | tc.Page404(ctx) |
| 636 | return |
| 637 | } |
| 638 | page := 0 |
| 639 | pageParam := ctx.Param("page") |
| 640 | pageRegexp := regexp.MustCompile(`question-(.*).xml`) |
| 641 | pageStr := pageRegexp.FindStringSubmatch(pageParam) |
| 642 | if len(pageStr) != 2 { |
| 643 | tc.Page404(ctx) |
| 644 | return |
| 645 | } |
| 646 | page = converter.StringToInt(pageStr[1]) |
| 647 | if page == 0 { |
| 648 | tc.Page404(ctx) |
| 649 | return |
| 650 | } |
| 651 | err := tc.templateRenderController.SitemapPage(ctx, page) |
| 652 | if err != nil { |
| 653 | tc.Page404(ctx) |
| 654 | return |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | func (tc *TemplateController) checkPrivateMode(ctx *gin.Context) bool { |
| 659 | resp, err := tc.siteInfoService.GetSiteSecurity(ctx) |
nothing calls this directly
no test coverage detected