Skip to content

Collaborative Owners Management - Add Collaborative Owner #37548

@Dalto1

Description

@Dalto1

Description

There is a bug into the Add Collaborative Owner lockup when trying to add collaborative starting with caps. I wasn't able to add my organization named with a caps (ex: OrganizationA). Ive been able to add it by renaming to "organizationa" temporary and then renaming again.
I'm not familiar with the code base but maybe the bug is here routers\web\repo\setting\actions.go ~L97

func AddCollaborativeOwner(ctx *context.Context) {
	name := strings.ToLower(ctx.FormString("collaborative_owner"))

	ownerID, err := user_model.GetUserOrOrgIDByName(ctx, name)
	if err != nil {
		if errors.Is(err, util.ErrNotExist) {
			ctx.Flash.Error(ctx.Tr("form.user_not_exist"))
			ctx.JSONErrorNotFound()
		} else {
			ctx.ServerError("GetUserOrOrgIDByName", err)
		}
		return
	}

	actionsUnit, err := ctx.Repo.Repository.GetUnit(ctx, unit_model.TypeActions)
	if err != nil {
		ctx.ServerError("GetUnit", err)
		return
	}
	actionsCfg := actionsUnit.ActionsConfig()
	actionsCfg.AddCollaborativeOwner(ownerID)
	if err := repo_model.UpdateRepoUnitConfig(ctx, actionsUnit); err != nil {
		ctx.ServerError("UpdateRepoUnitConfig", err)
		return
	}

	ctx.JSONOK()
}

Gitea Version

1.26.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Selfhosted

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions