Using upload file to hash and ban doesn't work as expected

(#593) Bug Fixed moderation self-hosting

Summary

When I go to my moderation panel and upload a file to be hashed and banned It never gets banned. I've checked this by hashing the image myself using the same hash type and checking if the hash was banned

Steps to reproduce

Go to moderation panel Go to file SHA blocklist Use upload file to hash and ban

Logs or screenshots

There's no obvious self hosting version number Version 149.0.7827.103 (Official Build) (64-bit) Ubuntu 26.04 LTS

2 comments

Sign in with Fluxer to comment and vote.
Comment by @johnh-harris
RexSystem 1 vote originally by @johnh-harris on GitHub
I believe I found the issue with this, but I would like a maintainer to look at what I'm doing. So if we go into fluxer_admin/src/api/bans.rs we will see at line 232
    pub async fn ban_file_sha(
        &self,
        sha256_hex: &str,
        audit_log_reason: Option<&str>,
    ) -> ApiResult<()> {
        let body = generated_types::BanFileShaRequest {
            category: None,
            content_type: None,
            notes: None,
            severity: None,
            sha256_hex: sha256_hex.to_owned(),
            source_url: None,
        };
        self.post_typed_with_reason::<(), _>("/admin/bans/file-sha/add", &body, audit_log_reason)
            .await
    }
Looking at other examples we have direct calls to bans in whats generated Example with phrases
    pub async fn ban_phrase(&self, phrase: &str) -> ApiResult<()> {
        let body = generated_types::BanPhraseRequest {
            phrase: phrase.to_owned(),
        };
        self.generated()
            .add_phrase_ban(&body)
            .await
            .map_err(|e| self.generated_error(e))?;
        Ok(())
    }
I believe the approach to solving is just a simple call
    pub async fn ban_file_sha(
        &self,
        sha256_hex: &str,
        audit_log_reason: Option<&str>,
    ) -> ApiResult<()> {
        let body = generated_types::BanFileShaRequest {
            category: None,
            content_type: None,
            notes: None,
            severity: None,
            sha256_hex: sha256_hex.to_owned(),
            source_url: None,
        };
        self.generated()
            .add_file_sha_ban(&body)
            .await
            .map_err(|e| self.generated_error(e))?;
        Ok(())
    }
Deleted comment
Removed by moderator Rex: Removed a general status note that was posted on many GitHub threads. It no longer applies here.