matrix-org / matrix-org/mjolnir
Error testing NsfwProtection protection
- Dominant language
- TypeScript
- Stars
- 445
- Forks
- 75
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 3
Description
I enabled the NsfwProtection protection but got this error while uploading an image to the protected room.
Is this feature ready to be used?
```
2025-02-20T19:27:51.067Z [mjolnir] Thu, 20 Feb 2025 19:27:51 GMT [INFO] [Mjolnir] Joined !HZhSiAdUKuyBvQfylx:banana
2025-02-20T19:29:13.649Z [mjolnir] Thu, 20 Feb 2025 19:29:13 GMT [INFO] [Mjolnir] Command being run by @operator1:banana: !mjolnir protections
2025-02-20T19:29:31.349Z [mjolnir] Thu, 20 Feb 2025 19:29:31 GMT [INFO] [Mjolnir] Command being run by @operator1:banana: !mjolnir enable NsfwProtection
2025-02-20T19:29:40.054Z [mjolnir] Thu, 20 Feb 2025 19:29:40 GMT [ERROR] [ProtectionManager] Error handling protection: NsfwProtection
2025-02-20T19:29:40.054Z [mjolnir] Thu, 20 Feb 2025 19:29:40 GMT [ERROR] [ProtectionManager] Failed event: https://matrix.to/#/!HZhSiAdUKuyBvQfylx:banana/$PZS24KWDE1rjzavvE45IcI6F3HbUv_U2bLlTBq9X-X4
2025-02-20T19:29:40.054Z [mjolnir] Thu, 20 Feb 2025 19:29:40 GMT [ERROR] [ProtectionManager] TypeError: Cannot read properties of undefined (reading 'classify')
2025-02-20T19:29:40.054Z [mjolnir] at NsfwProtection.handleEvent (/mjolnir/protections/NsfwProtection.js:87:54)
2025-02-20T19:29:40.054Z [mjolnir] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2025-02-20T19:29:40.054Z [mjolnir] at async ProtectionManager.handleEvent (/mjolnir/protections/ProtectionManager.js:285:36)
```
Contributor guide
Research direction
Start at protections/NsfwProtection.js:87, where the log reports the undefined value's classify call, and inspect the related ProtectionManager.js flow. Reproduce by enabling NsfwProtection and uploading an image to a protected room; done means the upload is handled without this TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100