mirror of
https://gitee.com/mafgwo/stackedit
synced 2024-11-16 03:32:40 +08:00
避免undefined文件提交
This commit is contained in:
parent
550bb2fd91
commit
96ea8cd0db
|
@ -3,4 +3,7 @@ node_modules
|
||||||
dist
|
dist
|
||||||
.history
|
.history
|
||||||
images
|
images
|
||||||
docs
|
docs
|
||||||
|
Dockerfile
|
||||||
|
README.md
|
||||||
|
build.sh
|
||||||
|
|
|
@ -59,7 +59,7 @@ exports.generate = (req, res) => {
|
||||||
const metadata = readJson(req.query.metadata);
|
const metadata = readJson(req.query.metadata);
|
||||||
const params = [];
|
const params = [];
|
||||||
|
|
||||||
params.push('--latex-engine=xelatex');
|
params.push('--pdf-engine=xelatex');
|
||||||
params.push('--webtex=http://chart.apis.google.com/chart?cht=tx&chf=bg,s,FFFFFF00&chco=000000&chl=');
|
params.push('--webtex=http://chart.apis.google.com/chart?cht=tx&chf=bg,s,FFFFFF00&chco=000000&chl=');
|
||||||
if (options.toc) {
|
if (options.toc) {
|
||||||
params.push('--toc');
|
params.push('--toc');
|
||||||
|
|
|
@ -317,6 +317,12 @@ export default {
|
||||||
isImg,
|
isImg,
|
||||||
commitMessage,
|
commitMessage,
|
||||||
}) {
|
}) {
|
||||||
|
// 非法的文件名 不让提交
|
||||||
|
if (!path || path.endsWith('undefined')) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
resolve({ res: { content: { sha: null } } });
|
||||||
|
});
|
||||||
|
}
|
||||||
let uploadContent = content;
|
let uploadContent = content;
|
||||||
if (isImg && typeof content !== 'string') {
|
if (isImg && typeof content !== 'string') {
|
||||||
uploadContent = await utils.encodeFiletoBase64(content);
|
uploadContent = await utils.encodeFiletoBase64(content);
|
||||||
|
|
|
@ -279,6 +279,12 @@ export default {
|
||||||
isImg,
|
isImg,
|
||||||
commitMessage,
|
commitMessage,
|
||||||
}) {
|
}) {
|
||||||
|
// 非法的文件名 不让提交
|
||||||
|
if (!path || path.endsWith('undefined')) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
resolve({ res: { content: { sha: null } } });
|
||||||
|
});
|
||||||
|
}
|
||||||
let uploadContent = content;
|
let uploadContent = content;
|
||||||
if (isImg && typeof content !== 'string') {
|
if (isImg && typeof content !== 'string') {
|
||||||
uploadContent = await utils.encodeFiletoBase64(content);
|
uploadContent = await utils.encodeFiletoBase64(content);
|
||||||
|
|
|
@ -179,6 +179,12 @@ export default {
|
||||||
isImg,
|
isImg,
|
||||||
commitMessage,
|
commitMessage,
|
||||||
}) {
|
}) {
|
||||||
|
// 非法的文件名 不让提交
|
||||||
|
if (!path || path.endsWith('undefined')) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
resolve({ res: { content: { sha: null } } });
|
||||||
|
});
|
||||||
|
}
|
||||||
let uploadContent = content;
|
let uploadContent = content;
|
||||||
if (isImg && typeof content !== 'string') {
|
if (isImg && typeof content !== 'string') {
|
||||||
uploadContent = await utils.encodeFiletoBase64(content);
|
uploadContent = await utils.encodeFiletoBase64(content);
|
||||||
|
|
|
@ -281,6 +281,12 @@ export default {
|
||||||
isImg,
|
isImg,
|
||||||
commitMessage,
|
commitMessage,
|
||||||
}) {
|
}) {
|
||||||
|
// 非法的文件名 不让提交
|
||||||
|
if (!path || path.endsWith('undefined')) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
resolve({ res: { content: { sha: null } } });
|
||||||
|
});
|
||||||
|
}
|
||||||
let uploadContent = content;
|
let uploadContent = content;
|
||||||
if (isImg && typeof content !== 'string') {
|
if (isImg && typeof content !== 'string') {
|
||||||
uploadContent = await utils.encodeFiletoBase64(content);
|
uploadContent = await utils.encodeFiletoBase64(content);
|
||||||
|
|
|
@ -131,6 +131,7 @@
|
||||||
if (withToken) {
|
if (withToken) {
|
||||||
withToken = false;
|
withToken = false;
|
||||||
xhr.open('GET', url);
|
xhr.open('GET', url);
|
||||||
|
xhr.send();
|
||||||
} else {
|
} else {
|
||||||
console.error('An error occurred: ' + xhr.status);
|
console.error('An error occurred: ' + xhr.status);
|
||||||
document.getElementById('div_info').innerHTML = `分享内容获取失败或已失效!请登录 <a href="${appUri}" target="_brank">主文档空间</a> 后再刷新此页面!`;
|
document.getElementById('div_info').innerHTML = `分享内容获取失败或已失效!请登录 <a href="${appUri}" target="_brank">主文档空间</a> 后再刷新此页面!`;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user