autofix: fix check for empty string (#6804)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
deepsource-autofix[bot]
2022-03-06 16:33:45 +08:00
committed by GitHub
parent 65526f84e1
commit deec3516d5
39 changed files with 82 additions and 86 deletions

View File

@@ -12,7 +12,7 @@ import (
)
func Markdown(c *context.APIContext, form api.MarkdownOption) {
if len(form.Text) == 0 {
if form.Text == "" {
_, _ = c.Write([]byte(""))
return
}

View File

@@ -142,7 +142,7 @@ func EditIssue(c *context.APIContext, form api.EditIssueOption) {
if c.Repo.IsWriter() && form.Assignee != nil &&
(issue.Assignee == nil || issue.Assignee.LowerName != strings.ToLower(*form.Assignee)) {
if len(*form.Assignee) == 0 {
if *form.Assignee == "" {
issue.AssigneeID = 0
} else {
assignee, err := db.GetUserByName(*form.Assignee)