fix(server): make sure getFileInfo
doesn't fail if detectSensitivity
ever fails (#9020)
This commit is contained in:
parent
e35f599b6d
commit
a3c2dbbfb5
1 changed files with 6 additions and 2 deletions
|
@ -101,13 +101,17 @@ export async function getFileInfo(path: string, opts: {
|
||||||
let porn = false;
|
let porn = false;
|
||||||
|
|
||||||
if (!opts.skipSensitiveDetection) {
|
if (!opts.skipSensitiveDetection) {
|
||||||
[sensitive, porn] = await detectSensitivity(
|
await detectSensitivity(
|
||||||
path,
|
path,
|
||||||
type.mime,
|
type.mime,
|
||||||
opts.sensitiveThreshold ?? 0.5,
|
opts.sensitiveThreshold ?? 0.5,
|
||||||
opts.sensitiveThresholdForPorn ?? 0.75,
|
opts.sensitiveThresholdForPorn ?? 0.75,
|
||||||
opts.enableSensitiveMediaDetectionForVideos ?? false,
|
opts.enableSensitiveMediaDetectionForVideos ?? false,
|
||||||
);
|
).then(value => {
|
||||||
|
[sensitive, porn] = value;
|
||||||
|
}, error => {
|
||||||
|
warnings.push(`detectSensitivity failed: ${error}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue