mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-18 04:09:33 +01:00
fix(links): scope comma handling to parenthesised paths
This commit is contained in:
1 parent
fd0e52496d
commit
168c15ae08
7 files changed
+70
-12
No files matched your search
@@ -213,6 +213,38 @@ function loadApp(fetchImpl: (url: string, init?: { body?: string }) => unknown)
|
||||
}
|
||||
|
||||
describe('guarded attachment registration results', () => {
|
||||
it.each(['svg', 'markdown', 'avif', 'bmp', 'ico', 'zip'])(
|
||||
'names a rejected workspace .%s path without describing it as external',
|
||||
async (extension) => {
|
||||
const { app } = loadApp(async () => ({
|
||||
ok: false,
|
||||
status: 400,
|
||||
json: async () => ({ error: 'Unsupported attachment type' }),
|
||||
}));
|
||||
const path = `/home/joe/wiki/out/system architecture.${extension}`;
|
||||
const result = await Object.getPrototypeOf(app)._registerExternalPreview.call(app, path, 's1');
|
||||
expect(result.status).toBe(400);
|
||||
expect(result.error).toContain(path);
|
||||
expect(result.error).not.toContain('outside the session workspace');
|
||||
}
|
||||
);
|
||||
|
||||
it('retains the external-file explanation for a rejected external type', async () => {
|
||||
const { app } = loadApp(async () => ({
|
||||
ok: false,
|
||||
status: 400,
|
||||
json: async () => ({ error: 'Unsupported attachment type' }),
|
||||
}));
|
||||
const result = await Object.getPrototypeOf(app)._registerExternalPreview.call(
|
||||
app,
|
||||
'/mnt/data/system architecture.svg',
|
||||
's1'
|
||||
);
|
||||
expect(result.error).toBe(
|
||||
'Cannot preview .svg from outside the session workspace (images, video, audio, PDF, Office documents and text files only).'
|
||||
);
|
||||
});
|
||||
|
||||
it.each([404, 403, 500, 503])('preserves HTTP %s for the activation decision', async (status) => {
|
||||
const { app, fetch } = loadApp(async () => ({
|
||||
ok: false,
|
||||
|
||||
Reference in new issue
Block a user