Skip to content

Commit 4f38c75

Browse files
committed
fix
1 parent 66dab87 commit 4f38c75

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

models/repo/repo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ func (repo *Repository) LoadUnits(ctx context.Context) (err error) {
362362
if log.IsTrace() {
363363
unitTypeStrings := make([]string, len(repo.Units))
364364
for i, unit := range repo.Units {
365-
unitTypeStrings[i] = unit.Type.String()
365+
unitTypeStrings[i] = unit.Type.LogString()
366366
}
367367
log.Trace("repo.Units, ID=%d, Types: [%s]", repo.ID, strings.Join(unitTypeStrings, ", "))
368368
}

models/repo/repo_unit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func IsErrUnitTypeNotExist(err error) bool {
3333
}
3434

3535
func (err ErrUnitTypeNotExist) Error() string {
36-
return fmt.Sprintf("Unit type does not exist: %s", err.UT.String())
36+
return fmt.Sprintf("Unit type does not exist: %s", err.UT.LogString())
3737
}
3838

3939
func (err ErrUnitTypeNotExist) Unwrap() error {

routers/web/web.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -384,18 +384,18 @@ func registerRoutes(m *web.Route) {
384384
return func(ctx *context.Context) {
385385
// only check global disabled units when ignoreGlobal is false
386386
if !ignoreGlobal && unitType.UnitGlobalDisabled() {
387-
ctx.NotFound(unitType.String(), nil)
387+
ctx.NotFound("Repo unit is is disabled:"+unitType.LogString(), nil)
388388
return
389389
}
390390

391391
if ctx.ContextUser == nil {
392-
ctx.NotFound(unitType.String(), nil)
392+
ctx.NotFound("ContextUser is nil", nil)
393393
return
394394
}
395395

396396
if ctx.ContextUser.IsOrganization() {
397397
if ctx.Org.Organization.UnitPermission(ctx, ctx.Doer, unitType) < accessMode {
398-
ctx.NotFound(unitType.String(), nil)
398+
ctx.NotFound("ContextUser is org but doer has no access to unit", nil)
399399
return
400400
}
401401
}
@@ -487,7 +487,7 @@ func registerRoutes(m *web.Route) {
487487
m.Get("/organizations", explore.Organizations)
488488
m.Get("/code", func(ctx *context.Context) {
489489
if unit.TypeCode.UnitGlobalDisabled() {
490-
ctx.NotFound(unit.TypeCode.String(), nil)
490+
ctx.NotFound("Rep unit code is disabled", nil)
491491
return
492492
}
493493
}, explore.Code)

0 commit comments

Comments
 (0)