Skip to content

Commit

Permalink
fix: 修复主页末尾有斜杠预览错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Nov 8, 2023
1 parent f1b977f commit b58f5c3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/adaptors/web/csdn/csdnConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { CategoryTypeEnum, PageTypeEnum, PasswordType } from "zhi-blog-api"
export class CsdnConfig extends CommonWebConfig {
constructor(username: string, password: string, middlewareUrl?: string) {
super("https://blog.csdn.net", "https://bizapi.csdn.net", username, password, middlewareUrl)
this.previewUrl = "[userid]/article/details/[postid]"
this.previewUrl = "/[userid]/article/details/[postid]"
this.pageType = PageTypeEnum.Markdown
this.usernameEnabled = false
this.passwordType = PasswordType.PasswordType_Cookie
Expand Down
2 changes: 1 addition & 1 deletion src/components/publish/form/PublishPlatform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ onMounted(async () => {

<template>
<div>
<p>请选择要发布的平台2:</p>
<p>请选择要发布的平台:</p>
<div class="syp-distri-platform-container">
<a v-for="cfg in formData.dynamicConfigArray" class="distri-item" @click="handleCheck(cfg.platformKey)">
<el-tooltip :content="CrossPageUtils.longPlatformName(cfg.platformName, 20)" placement="bottom">
Expand Down
4 changes: 2 additions & 2 deletions src/composables/usePublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ const usePublish = () => {
const postMeta = ObjectUtil.getProperty(setting, id, {})
const newPostid = postMeta[posidKey]
let previewUrl = await api.getPreviewUrl(newPostid)
const isAbsoluteUrl = /^http/.test(previewUrl)
return isAbsoluteUrl ? previewUrl : `${cfg?.home ?? ""}${previewUrl}`
const isAbsoluteUrl = /^[a-z]+:\/\//.test(previewUrl)
return isAbsoluteUrl ? previewUrl : StrUtil.pathJoin(cfg?.home ?? "", previewUrl)
}

/**
Expand Down

0 comments on commit b58f5c3

Please sign in to comment.