Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too long description of organizations breaks UI #6755

Closed
1 task done
shaoran opened this issue Apr 25, 2019 · 8 comments · Fixed by #7385
Closed
1 task done

Too long description of organizations breaks UI #6755

shaoran opened this issue Apr 25, 2019 · 8 comments · Fixed by #7385
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented topic/ui Change the appearance of the Gitea UI type/bug

Comments

@shaoran
Copy link

shaoran commented Apr 25, 2019

Description

  • create a new organization and/or edit an existing one
  • In the description field use more than 254 characters
  • click on update setting

You'll get the following error:

template: org/settings/options:41:110: executing "org/settings/options" at <eq .CurrentVisibility 0>: error calling eq: invalid type for comparison

The text field should allow max. 254 characters or the description in the database should allow more characters.

@lunny lunny added type/bug topic/ui Change the appearance of the Gitea UI labels Apr 25, 2019
@adelowo
Copy link
Member

adelowo commented Apr 26, 2019

I cannot replicate this. There is actually validation in place to protect against this kind of thing.

@shaoran How were you able to make a description of more than 254 characters

Screenshot 2019-04-26 at 17 08 41

@mrsdizzie
Copy link
Member

@adelowo that is the repo description -- this error is about the description of an org: if you go to https://example.com/org/orgname/settings you can see.

@adelowo
Copy link
Member

adelowo commented Apr 26, 2019

Damn... I haven't had enough water today :)

Will take a look at it

@shaoran
Copy link
Author

shaoran commented Apr 26, 2019

@adelowo no problem, we all do mistakes. To answer your question, I copied and pasted a couple of paragraphs (3 to be precise) from our company homepage, that leads to more than 255 characters.

@mrsdizzie
Copy link
Member

it looks like updating an org settings is maybe missing helper functions to check these types of things similar to what repos and org_teams have:

func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err error) {

// UpdateTeam updates information of team.

Updating an org uses updateUser:

gitea/models/user.go

Lines 971 to 974 in 81059a2

func updateUser(e Engine, u *User) error {
_, err := e.ID(u.ID).AllCols().Update(u)
return err
}

But the truncating for a user happens in this BeforeUpdate:

// BeforeUpdate is invoked from XORM before updating this object.

Which maybe doesn't happen for an org. I'm not totally familiar with how it all works though

@stale
Copy link

stale bot commented Jun 25, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jun 25, 2019
@Cherrg
Copy link
Contributor

Cherrg commented Jul 8, 2019

This also affects the organisation name if there are added more than 40 letters

@stale stale bot removed the issue/stale label Jul 8, 2019
Cherrg added a commit to Cherrg/gitea that referenced this issue Jul 8, 2019
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Jul 8, 2019
Cherrg added a commit to Cherrg/gitea that referenced this issue Jul 8, 2019
lunny pushed a commit that referenced this issue Jul 8, 2019
@Cherrg
Copy link
Contributor

Cherrg commented Jul 8, 2019

Which maybe doesn't happen for an org. I'm not totally familiar with how it all works though

@mrsdizzie JFYI: I found, that organisations are nearly the same as users, they share the same model. It's a flag, so these update functions got called. It was just a missing variable for template.

lafriks pushed a commit that referenced this issue Jul 8, 2019
jeffliu27 pushed a commit to jeffliu27/gitea that referenced this issue Jul 18, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants