Skip to content

Commit 906d2d3

Browse files
authored
Fix Artboard image URL replace. (#20)
1 parent 52253d9 commit 906d2d3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

feishu-pages/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "feishu-pages",
3-
"version": "0.7.1",
3+
"version": "0.7.2",
44
"description": "Generate Feishu Wiki into a Markdown for work with Static Page Generators.",
55
"repository": {
66
"url": "https://github.com/longbridgeapp/feishu-pages"

feishu-pages/src/feishu.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,6 @@ export const feishuDownload = async (fileToken: string, localPath: string, type:
331331
);
332332
}
333333

334-
let suffix = type == 'board' ? '-board' : '';
335-
localPath = localPath + suffix;
336-
337334
if (extension) {
338335
localPath = localPath + "." + extension;
339336
}

feishu-pages/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,14 @@ const downloadFiles = async (
154154
}
155155

156156
for (const fileToken in fileTokens) {
157+
let base_filename = fileToken;
158+
if (fileTokens[fileToken].type == 'board') {
159+
base_filename = base_filename + '-board';
160+
}
161+
157162
const filePath = await feishuDownload(
158163
fileToken,
159-
path.join(path.join(DOCS_DIR, 'assets'), fileToken),
164+
path.join(path.join(DOCS_DIR, 'assets'), base_filename),
160165
fileTokens[fileToken].type
161166
);
162167
if (!filePath) {
@@ -165,7 +170,7 @@ const downloadFiles = async (
165170

166171
const extension = path.extname(filePath);
167172

168-
let assetURL = `/assets/${fileToken}${extension}`;
173+
let assetURL = `/assets/${base_filename}${extension}`;
169174

170175
// Replase Markdown image
171176
content = replaceLinks(content, fileToken, assetURL);

0 commit comments

Comments
 (0)