Browse Source

fix:md文件bug修复

master
prr 7 months ago
parent
commit
02f8ad00df
  1. 18
      frontend/src/components/builtin/MarkDown.vue
  2. 8
      frontend/src/system/core/FileOs.ts

18
frontend/src/components/builtin/MarkDown.vue

@ -4,6 +4,7 @@
import { getSplit, getSystemConfig } from "@/system/config";
import { decodeBase64, isBase64 } from "@/util/file";
import { notifyError, notifySuccess } from "@/util/msg";
import { isShareFile } from "@/util/sharePath.ts";
import { getMdOption } from "@/util/vditor";
import { saveAs } from "file-saver";
import moment from "moment";
@ -112,20 +113,19 @@
} else {
refreshDesktop = true;
}
let res
if (isShareFile(filepath.value)) {
const file = await sys?.fs.getShareInfo(filepath.value);
const isWrite =
file.fs.sender === getSystemConfig().userInfo.id
? 1
: file.fs.is_write;
//console.log(path)
const res = file.fi.isShare
? await sys?.fs.writeShareFile(
const isWrite = file.fs.sender === getSystemConfig().userInfo.id ? 1 : file.fs.is_write;
res = await sys?.fs.writeShareFile(
filepath.value,
vditor.value.getValue(),
isWrite
)
: await sys?.fs.writeFile(filepath.value, vditor.value.getValue());
if (res.success) {
} else {
res = await sys?.fs.writeFile(filepath.value, vditor.value.getValue());
}
if (res && res.code !== -1) {
notifySuccess(res.message || "保存成功!");
} else {
notifyError(res.message || "保存失败");

8
frontend/src/system/core/FileOs.ts

@ -115,15 +115,17 @@ export async function handleExists(path: string): Promise<any> {
export async function handleReadFile(path: string, header?: { [key: string]: string }): Promise<any> {
const userType = getSystemConfig().userType
//console.log('请求头:', header);
// let head = userType === 'member' ? { pwd: header?.pwd || '' } : { ...header }
let head = {}
if (userType === 'member') {
head = {
pwd: header?.pwd || ''
}
} else if (getSystemConfig().file.isPwd === 1) {
// } else if (getSystemConfig().file.isPwd === 1) {
} else if (header) {
head = {
pwd: md5(header?.pwd || ''),
pwd: header?.pwd === '' ? '' : md5(header?.pwd),
salt: header?.salt || ''
}
}
@ -426,6 +428,8 @@ export const useOsFile = () => {
}
}
}
} else {
head = { ...header }
}
const response = await handleWriteFile(path, content, head);

Loading…
Cancel
Save