Skip to content

Commit 106a11b

Browse files
committed
fix: use chinese hash in filename
1 parent 33de969 commit 106a11b

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Diff for: package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-cnb",
33
"displayName": "博客园 cnblogs 客户端",
44
"description": "Cnblogs Client For VSCode",
5-
"version": "0.0.1",
5+
"version": "1.8.58",
66
"license": "LICENSE.txt",
77
"preview": false,
88
"publisher": "cnblogs",

Diff for: src/cmd/post-list/post-pull.ts

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ export async function postPull(input: InputType, showConfirm = true, mute = fals
4545
}
4646

4747
let uriPath = PostFileMapManager.getFilePath(post.id)
48+
49+
if (uriPath != null && uriPath.indexOf('#') < 0 && post.title.indexOf('#') >= 0) uriPath = undefined
50+
4851
let fileUri: Uri
4952
if (uriPath == null) {
5053
fileUri = PostFileMapManager.buildLocalPostFileUri(post)

Diff for: src/service/post/post-file-map.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export namespace PostFileMapManager {
2929
export function buildLocalPostFileUri(post: Post, appendToFileName = ''): Uri {
3030
const workspaceUri = WorkspaceCfg.getWorkspaceUri()
3131
const ext = `${post.isMarkdown ? 'md' : 'html'}`
32-
let postTitle = sanitizeFileName(post.title)
32+
let postTitle = post.title.replace(/#/g, '#')
33+
postTitle = sanitizeFileName(postTitle)
3334
if (/\.\d+$/.test(postTitle)) postTitle += '_'
3435
return Uri.joinPath(workspaceUri, `${postTitle}${appendToFileName}.${post.id}.${ext}`)
3536
}

0 commit comments

Comments
 (0)