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

Issue template with empty labels value #17877

Closed
karolyi opened this issue Dec 1, 2021 · 1 comment · Fixed by #21831
Closed

Issue template with empty labels value #17877

karolyi opened this issue Dec 1, 2021 · 1 comment · Fixed by #21831
Labels

Comments

@karolyi
Copy link

karolyi commented Dec 1, 2021

Gitea Version

1.15.6

Git Version

2.34.1

Operating System

FreeBSD

How are you running Gitea?

I run Gitea in a FreeBSD jail, installed from the package.

Database

MySQL

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

Description

Hey,

when using an issue template that has an empty labels string (which github accepts), gitea bails out at reading the template with an

2021/12/02 00:31:21 ...ules/context/repo.go:927:IssueTemplatesFromDefaultBranch() [D] ExtractMetadata: yaml: unmarshal errors:
          line 4: cannot unmarshal !!str `` into []string

error.

Upon investigating the source, this seems to be coming from the labels key having an empty value in the issue template:

---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: ''
assignees: ''

---
<!-- Please don't delete this template or we'll close your issue -->

- [ ] I have read and understood the [FAQ](https://gitea.ksol.io/karolyi/py3-validate-email/src/branch/master/FAQ.md)

**Describe the bug**

A clear and concise description of what the bug is.

**To Reproduce**

Steps to reproduce the behavior:

**My debug output**

Output from the debug run described in the FAQ:

**Expected behavior**

A clear and concise description of what you expected to happen.

**Please complete the following information:**
 - OS: [e.g. Linux, FreeBSD, Windows]
 - Flavor and Version [e.g. Debian 22, FreeBSD 12.2]
 - Your network environment (ISP provided home connecton, or testing from an actual whitelisted server)
 - Your exact `py3-validate-email` module version

**Additional context**

Add any other context about the problem here.

I will try and remove that key now and see if it works, but this behavior was accepted with github, whereas it isn't with gitea. A quick fix would be nice to have for it, so other people won't bump into the same problem wondering why issue templates doesn't work after migrating from github.

Screenshots

No response

@mscherer
Copy link
Contributor

mscherer commented Dec 3, 2021

So, on https://github.com/go-gitea/gitea/blob/main/modules/structs/issue.go#L129

Labels is supposed to be a string array, not a string. I assume the yaml parser from github (in ruby I guess) is more forgiving than the one in go.

I see nothing in the doc of the module that allow to change that.

@lunny lunny added the type/bug label Dec 4, 2021
zeripath pushed a commit that referenced this issue Nov 19, 2022
The [labels in issue YAML
templates](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax)
can be a string array or a comma-delimited string, so a single string
should be valid labels.

The old codes committed in #20987 ignore this, that's why the warning is
displayed:

<img width="618" alt="image"
src="https://user-images.githubusercontent.com/9418365/202112642-93dc72d0-71c3-40a2-9720-30fc2d48c97c.png">

Fixes #17877.
zeripath pushed a commit that referenced this issue Nov 20, 2022
…21873)

Backport #21831.

The [labels in issue YAML templates](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax)
can be a string array or a comma-delimited string, so a single string
should be valid labels.

The old codes committed in #20987 ignore this, that's why the warning is
displayed:

<img width="618" alt="image" src="https://user-images.githubusercontent.com/9418365/202112642-93dc72d0-71c3-40a2-9720-30fc2d48c97c.png">

Fixes #17877.
fsologureng pushed a commit to fsologureng/gitea that referenced this issue Nov 22, 2022
…21831)

The [labels in issue YAML
templates](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax)
can be a string array or a comma-delimited string, so a single string
should be valid labels.

The old codes committed in go-gitea#20987 ignore this, that's why the warning is
displayed:

<img width="618" alt="image"
src="https://user-images.githubusercontent.com/9418365/202112642-93dc72d0-71c3-40a2-9720-30fc2d48c97c.png">

Fixes go-gitea#17877.
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants