aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/github
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-12-04 12:29:24 +0100
committerGitHub <noreply@github.com>2021-12-04 12:29:24 +0100
commitcadbccb533b8270e0cc51ee27462240d9c421f8d (patch)
treeee73f8a37ec2fd349b5f0cf2336f706c38530a6d /bridge/github
parent8fefcbd58e29084a9e511ce967b48090cbc5ddcd (diff)
parent160ba2420b0d09b744d96c102f863134a6f8cfd8 (diff)
downloadgit-bug-cadbccb533b8270e0cc51ee27462240d9c421f8d.tar.gz
Merge pull request #727 from MichaelMure/rng-dynamics/fix-import-empty-title
Fix: github import, some issue titles cause error
Diffstat (limited to 'bridge/github')
-rw-r--r--bridge/github/import.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/bridge/github/import.go b/bridge/github/import.go
index 2cf90924..1db67469 100644
--- a/bridge/github/import.go
+++ b/bridge/github/import.go
@@ -195,12 +195,11 @@ func (gi *githubImporter) ensureIssue(ctx context.Context, repo *cache.RepoCache
}
// At Github there exist issues with seemingly empty titles. An example is
- // https://github.com/NixOS/nixpkgs/issues/72730 .
- // The title provided by the GraphQL API actually consists of a space followed by a
- // zero width space (U+200B). This title would cause the NewBugRaw() function to
- // return an error: empty title.
- title := string(issue.Title)
- if title == " \u200b" { // U+200B == zero width space
+ // https://github.com/NixOS/nixpkgs/issues/72730 (here the title is actually
+ // a zero width space U+200B).
+ // Set title to some non-empty string, since git-bug does not accept empty titles.
+ title := text.CleanupOneLine(string(issue.Title))
+ if text.Empty(title) {
title = EmptyTitlePlaceholder
}
@@ -375,12 +374,11 @@ func (gi *githubImporter) ensureTimelineItem(ctx context.Context, repo *cache.Re
}
// At Github there exist issues with seemingly empty titles. An example is
- // https://github.com/NixOS/nixpkgs/issues/72730 .
- // The title provided by the GraphQL API actually consists of a space followed
- // by a zero width space (U+200B). This title would cause the NewBugRaw()
- // function to return an error: empty title.
+ // https://github.com/NixOS/nixpkgs/issues/72730 (here the title is actually
+ // a zero width space U+200B).
+ // Set title to some non-empty string, since git-bug does not accept empty titles.
title := text.CleanupOneLine(string(item.RenamedTitleEvent.CurrentTitle))
- if title == " \u200b" { // U+200B == zero width space
+ if text.Empty(title) {
title = EmptyTitlePlaceholder
}