-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
yaml/yml label file if/else guards #23717
Conversation
modules/label/parser.go
Outdated
data, err = options.Labels(name) | ||
if err != nil { | ||
return nil, ErrTemplateLoad{name, fmt.Errorf("GetRepoInitFile: %w", err)} | ||
if filepath.Ext(name) == ". yaml" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions:
". yaml"
: a space in it?- Gitea has builtin
Advanced.yaml
, if a user puts a customizedAdvance.yml
, then still the builtinAdvanced.yaml
is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Typo (will correct )
- Good question. I need to check but the built-in Advanced.yaml isn't in the custom options directory. It does raise the question that if some adds foo.yaml and foo.yml ... What should be used
I don't think this is right. Is the intention here that if See #23719 |
The intent was if the suffix was yaml then execute the parser but I don't think your proposed solution actually solves the problem. |
…o options The previous code did not remove the .yaml/.yml extension from label files within the customPath. This would lead to duplicate lists of labels. Fix go-gitea#23715 Close go-gitea#23717 Signed-off-by: Andrew Thornton <[email protected]>
Fix #23715 Other related PRs: * #23717 * #23716 * #23719 This PR is different from others, it tries to resolve the problem fundamentally (and brings more benefits) Although it looks like some more lines are added, actually many new lines are for tests. ---- Before, the code was just "guessing" the file type and try to parse them. <details> ![image](https://user-images.githubusercontent.com/2114189/228002245-57d58e27-1078-4da9-bf42-5bc0b264c6ce.png) </details> This PR: * Always remember the original option file names, and always use correct parser for them. * Another benefit is that we can sort the Label Templates now (before there was a map, its key order is undefined) ![image](https://user-images.githubusercontent.com/2114189/228002432-931b9f18-3908-484b-a36b-04760c9ad132.png)
…23749) Fix go-gitea#23715 Other related PRs: * go-gitea#23717 * go-gitea#23716 * go-gitea#23719 This PR is different from others, it tries to resolve the problem fundamentally (and brings more benefits) Although it looks like some more lines are added, actually many new lines are for tests. ---- Before, the code was just "guessing" the file type and try to parse them. <details> ![image](https://user-images.githubusercontent.com/2114189/228002245-57d58e27-1078-4da9-bf42-5bc0b264c6ce.png) </details> This PR: * Always remember the original option file names, and always use correct parser for them. * Another benefit is that we can sort the Label Templates now (before there was a map, its key order is undefined) ![image](https://user-images.githubusercontent.com/2114189/228002432-931b9f18-3908-484b-a36b-04760c9ad132.png) # Conflicts: # modules/label/parser.go # routers/web/org/setting.go # routers/web/repo/issue_label.go # templates/repo/create.tmpl # templates/repo/issue/labels/label_load_template.tmpl
ensure the legacy label parser is not called if a yaml file is detected. fixes #23715
Signed-off-by: Jon Roadley-Battin [email protected]