Compare commits

..

2 Commits

Author SHA1 Message Date
DebaucheryLibrarian c9b774c498 1.167.9 2021-02-05 03:13:17 +01:00
DebaucheryLibrarian 3e813ca251 Prevent writing to media hasher when hasher stream has closed. 2021-02-05 03:13:10 +01:00
3 changed files with 8 additions and 4 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "traxxx",
"version": "1.167.8",
"version": "1.167.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "traxxx",
"version": "1.167.8",
"version": "1.167.9",
"description": "All the latest porn releases in one place",
"main": "src/app.js",
"scripts": {

View File

@ -504,10 +504,10 @@ async function fetchSource(source, baseMedia) {
const maxAttempts = source.attempts || 3;
logger.silly(`Fetching media from ${source.src}`);
// attempts
async function attempt(attempts = 1) {
const hasher = new blake2.Hash('blake2b', { digestLength: 24 });
let hasherReady = true;
hasher.setEncoding('hex');
try {
@ -519,7 +519,10 @@ async function fetchSource(source, baseMedia) {
hashStream.on('data', (chunk) => {
size += chunk.length;
hasher.write(chunk);
if (hasherReady) {
hasher.write(chunk);
}
});
const { mimetype } = source.stream
@ -551,6 +554,7 @@ async function fetchSource(source, baseMedia) {
},
};
} catch (error) {
hasherReady = false;
hasher.end();
if (error.code !== 'VERIFY_TYPE') {