Skip to content

Commit

Permalink
fix: slugify github issue title (#1218)
Browse files Browse the repository at this point in the history
* fix: slugify github issue title

* fix: testcase fixed
  • Loading branch information
Harshita-mindfire committed Aug 26, 2021
1 parent 4d344fe commit e6c2638
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("GithubPod import pod", () => {
],
},
};
fname = "github.issues.902-Test Issue";
fname = "github.issues.902-test-issue";
});

test("Import Issue with status: open", async () => {
Expand Down
10 changes: 7 additions & 3 deletions packages/pods-core/src/builtin/GithubPod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Time,
DEngineClient,
ERROR_SEVERITY,
getSlugger,
} from "@dendronhq/common-all";

const ID = "dendron.github";
Expand Down Expand Up @@ -216,15 +217,18 @@ export class GithubImportPod extends ImportPod<GithubImportPodConfig> {
fname: string,
config: ImportPodConfig
) => {
const slugger = getSlugger();
return data.map((d: any) => {
const labels = d.node.labels.edges;
let tags: any;
if (labels.length > 0) {
tags = labels.map((label: any) => label.node.name);
}
d.node.title = d.node.title.replace(
/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, // eslint-disable-line
""
d.node.title = slugger.slug(
d.node.title.replace(
/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, // eslint-disable-line
""
)
);
d.node = {
body: d.node.body,
Expand Down

0 comments on commit e6c2638

Please sign in to comment.