Skip to content

Commit

Permalink
fix:bug && feat: 自动保存文本内容 &&feat:支持代码块复制
Browse files Browse the repository at this point in the history
  • Loading branch information
ling-drag0n authored Dec 4, 2024
1 parent 238d236 commit e51fce7
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5526,20 +5526,22 @@ async function handlePaste(request, env) {
);
}

// 检查是否存在于文件分享中
const existingFile = await env.FILE_STORE.get(customId);
if (existingFile) {
return new Response(
JSON.stringify({
message: "该链接后缀已被用于文件分享,请更换一个",
status: "error",
usedBy: "file",
}),
{
status: 400,
headers: { "Content-Type": "application/json" },
}
);
// 检查是否存在于文件分享中 - 只在 FILE_STORE 存在时检查
if (env.FILE_STORE) {
const existingFile = await env.FILE_STORE.get(customId);
if (existingFile) {
return new Response(
JSON.stringify({
message: "该链接后缀已被用于文件分享,请更换一个",
status: "error",
usedBy: "file",
}),
{
status: 400,
headers: { "Content-Type": "application/json" },
}
);
}
}
}

Expand Down

0 comments on commit e51fce7

Please sign in to comment.