Skip to content

Commit

Permalink
Fix Artboard image URL replace. (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee authored Oct 28, 2024
1 parent 52253d9 commit 906d2d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion feishu-pages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "feishu-pages",
"version": "0.7.1",
"version": "0.7.2",
"description": "Generate Feishu Wiki into a Markdown for work with Static Page Generators.",
"repository": {
"url": "https://github.com/longbridgeapp/feishu-pages"
Expand Down
3 changes: 0 additions & 3 deletions feishu-pages/src/feishu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,6 @@ export const feishuDownload = async (fileToken: string, localPath: string, type:
);
}

let suffix = type == 'board' ? '-board' : '';
localPath = localPath + suffix;

if (extension) {
localPath = localPath + "." + extension;
}
Expand Down
9 changes: 7 additions & 2 deletions feishu-pages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,14 @@ const downloadFiles = async (
}

for (const fileToken in fileTokens) {
let base_filename = fileToken;
if (fileTokens[fileToken].type == 'board') {
base_filename = base_filename + '-board';
}

const filePath = await feishuDownload(
fileToken,
path.join(path.join(DOCS_DIR, 'assets'), fileToken),
path.join(path.join(DOCS_DIR, 'assets'), base_filename),
fileTokens[fileToken].type
);
if (!filePath) {
Expand All @@ -165,7 +170,7 @@ const downloadFiles = async (

const extension = path.extname(filePath);

let assetURL = `/assets/${fileToken}${extension}`;
let assetURL = `/assets/${base_filename}${extension}`;

// Replase Markdown image
content = replaceLinks(content, fileToken, assetURL);
Expand Down

0 comments on commit 906d2d3

Please sign in to comment.