Restore the v2.1.19 application baseline and retain only the focused import preflight summary with duplicate, unavailable, destination, job, and size-limit visibility.
This commit is contained in:
@@ -1,24 +1,11 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const { assertUploadConfirmation, selectPublicUploadUrl } = require('../lib/upload-confirmation');
|
||||
const { assertUploadConfirmation } = require('../lib/upload-confirmation');
|
||||
|
||||
test('selects only a real public URL for logs and exports', () => {
|
||||
assert.equal(selectPublicUploadUrl({ download_url: 'https://doodstream.com/d/abc123', file_code: 'abc123' }), 'https://doodstream.com/d/abc123');
|
||||
assert.equal(selectPublicUploadUrl({ embed_url: 'https://voe.sx/e/abc123', file_code: 'abc123' }), 'https://voe.sx/e/abc123');
|
||||
assert.equal(selectPublicUploadUrl({ download_url: 'javascript:alert(1)', file_code: 'abc123' }), '');
|
||||
assert.equal(selectPublicUploadUrl({ file_code: 'abc123' }), '');
|
||||
});
|
||||
|
||||
test('materializes canonical Doodstream URLs from a confirmed file code', () => {
|
||||
assert.deepEqual(
|
||||
assertUploadConfirmation({ file_code: 'AB1', download_url: null, embed_url: null }, 'doodstream.com'),
|
||||
{
|
||||
file_code: 'AB1',
|
||||
download_url: 'https://doodstream.com/d/AB1',
|
||||
embed_url: 'https://doodstream.com/e/AB1'
|
||||
}
|
||||
);
|
||||
test('accepts a host-confirmed file code without a public URL', () => {
|
||||
const result = { file_code: 'AB1', download_url: null, embed_url: null };
|
||||
assert.equal(assertUploadConfirmation(result, 'doodstream.com'), result);
|
||||
});
|
||||
|
||||
test('accepts upload URLs for every supported hoster and its subdomains', () => {
|
||||
@@ -31,15 +18,7 @@ test('accepts upload URLs for every supported hoster and its subdomains', () =>
|
||||
];
|
||||
for (const [hoster, downloadUrl] of cases) {
|
||||
const result = { file_code: 'abc123', download_url: downloadUrl };
|
||||
const confirmed = assertUploadConfirmation(result, hoster);
|
||||
if (hoster === 'doodstream.com') {
|
||||
assert.deepEqual(confirmed, {
|
||||
...result,
|
||||
embed_url: 'https://doodstream.com/e/abc123'
|
||||
});
|
||||
} else {
|
||||
assert.equal(confirmed, result);
|
||||
}
|
||||
assert.equal(assertUploadConfirmation(result, hoster), result);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,40 +48,6 @@ test('accepts the Doodstream result domain returned by the current upload servic
|
||||
});
|
||||
});
|
||||
|
||||
test('rebuilds every accepted Doodstream transport URL from the file code', () => {
|
||||
const variants = [
|
||||
'http://dsvplay.com/d/DOODCODE1234?token=SYNTHETIC_SECRET#fragment',
|
||||
'https://edge.dsvplay.com/result/DOODCODE1234?session=SYNTHETIC_SESSION',
|
||||
'https://dood.to/e/DOODCODE1234',
|
||||
'https://dood.la/arbitrary/DOODCODE1234'
|
||||
];
|
||||
|
||||
for (const downloadUrl of variants) {
|
||||
assert.deepEqual(
|
||||
assertUploadConfirmation({ file_code: 'DOODCODE1234', download_url: downloadUrl }, 'doodstream.com'),
|
||||
{
|
||||
file_code: 'DOODCODE1234',
|
||||
download_url: 'https://doodstream.com/d/DOODCODE1234',
|
||||
embed_url: 'https://doodstream.com/e/DOODCODE1234'
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('rejects code-only confirmations for hosters without canonical materialization', () => {
|
||||
assert.throws(
|
||||
() => assertUploadConfirmation({ file_code: 'BYSE123' }, 'byse.sx'),
|
||||
/Upload zu byse\.sx wurde nicht bestätigt/
|
||||
);
|
||||
});
|
||||
|
||||
test('rejects non-HTTPS public URLs outside Doodstream transport normalization', () => {
|
||||
assert.throws(
|
||||
() => assertUploadConfirmation({ file_code: 'VOE123', download_url: 'http://voe.sx/VOE123' }, 'voe.sx'),
|
||||
/Upload zu voe\.sx wurde nicht bestätigt/
|
||||
);
|
||||
});
|
||||
|
||||
test('rejects an upload URL from a different domain', () => {
|
||||
assert.throws(
|
||||
() => assertUploadConfirmation({ file_code: 'abc123', download_url: 'https://attacker.invalid/file/abc123' }, 'voe.sx'),
|
||||
|
||||
Reference in New Issue
Block a user