Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Refuse dangling links too when unpacking

Fei2411545594025a33
diff --git a/ds-bot/office.js b/ds-bot/office.js
index 6f21a418..84991b56 100644
--- a/ds-bot/office.js
+++ b/ds-bot/office.js
@@ -6978,7 +6978,7 @@ var Package = class _Package {
mkdirSync(dirname(file), { recursive: true });
const parentReal = realpathSync(dirname(file));
if (parentReal !== rootReal && !parentReal.startsWith(rootReal + sep)) fail2(`unpack: ${name} resolves outside ${dir}`);
- if (existsSync(file) && lstatSync(file).isSymbolicLink()) fail2(`unpack: ${name} is a link`);
+ if (lstatSync(file, { throwIfNoEntry: false })?.isSymbolicLink()) fail2(`unpack: ${name} is a link`);
const data = this.get(name);
if (name.endsWith(".xml") || name.endsWith(".rels")) {
try {
diff --git a/ds-bot/src/office/package.js b/ds-bot/src/office/package.js
index 546e2399..54da6db6 100644
--- a/ds-bot/src/office/package.js
+++ b/ds-bot/src/office/package.js
@@ -206,7 +206,7 @@ export class Package {
// A linked subdirectory walks the write outside the destination.
const parentReal = realpathSync(dirname(file))
if (parentReal !== rootReal && !parentReal.startsWith(rootReal + sep)) fail(`unpack: ${name} resolves outside ${dir}`)
- if (existsSync(file) && lstatSync(file).isSymbolicLink()) fail(`unpack: ${name} is a link`)
+ if (lstatSync(file, { throwIfNoEntry: false })?.isSymbolicLink()) fail(`unpack: ${name} is a link`)
const data = this.get(name)
if (name.endsWith('.xml') || name.endsWith('.rels')) {
try { writeFileSync(file, prettyForUnpack(data)); continue } catch { /* fall back to raw */ }