Skip to content

Commit

Permalink
fix: Crash if category is a array ;
Browse files Browse the repository at this point in the history
Close #97
  • Loading branch information
Mara-Li committed Jan 31, 2023
1 parent 014cd6e commit 1f2ba90
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugin/contents_conversion/filePathConvertor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function folderNoteIndexYAML(
frontmatter: FrontMatterCache,
settings: GitHubPublisherSettings
): string {
const category = frontmatter[settings.yamlFolderKey];
const category = frontmatter[settings.yamlFolderKey] instanceof Array ? frontmatter[settings.yamlFolderKey].join("/") : frontmatter[settings.yamlFolderKey];
const parentCatFolder = !category.endsWith("/")
? category.split("/").at(-1)
: category.split("/").at(-2);
Expand Down Expand Up @@ -276,6 +276,7 @@ function createFrontmatterPath(
frontmatter: FrontMatterCache,
fileName: string
): string {
const folderCategory = frontmatter[settings.yamlFolderKey] instanceof Array ? frontmatter[settings.yamlFolderKey].join("/") : frontmatter[settings.yamlFolderKey];
let path =
settings.folderDefaultName.length > 0
? settings.folderDefaultName + "/" + fileName
Expand All @@ -287,7 +288,7 @@ function createFrontmatterPath(
if (frontmatter && frontmatter[settings.yamlFolderKey]) {
path =
folderRoot +
frontmatter[settings.yamlFolderKey] +
folderCategory +
"/" +
folderNoteIndexYAML(fileName, frontmatter, settings);
}
Expand Down

0 comments on commit 1f2ba90

Please sign in to comment.