fix: ensure apidoc uses utf-8 text
This commit is contained in:
@@ -13,7 +13,8 @@ server {
|
|||||||
|
|
||||||
# Markdown 接口说明,直接返回文本内容
|
# Markdown 接口说明,直接返回文本内容
|
||||||
location = /apidoc {
|
location = /apidoc {
|
||||||
default_type text/markdown;
|
types { }
|
||||||
|
default_type text/plain;
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
try_files /apidoc =404;
|
try_files /apidoc =404;
|
||||||
add_header Cache-Control "no-store";
|
add_header Cache-Control "no-store";
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ function writeTextFile(target, content) {
|
|||||||
function copyApiDoc() {
|
function copyApiDoc() {
|
||||||
const source = path.join(rootDir, 'docs', '知识库API接口说明.md')
|
const source = path.join(rootDir, 'docs', '知识库API接口说明.md')
|
||||||
const content = fs.readFileSync(source, 'utf8')
|
const content = fs.readFileSync(source, 'utf8')
|
||||||
writeTextFile(apiDocPath, content)
|
// /apidoc 是无扩展名文本接口;写入 UTF-8 BOM,避免部分静态服务器或浏览器按非 UTF-8 猜测导致中文乱码。
|
||||||
|
writeTextFile(apiDocPath, `\uFEFF${content}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractConstArrayFromTs(filePath, constName) {
|
function extractConstArrayFromTs(filePath, constName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user