Fix problems with logging binary data

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent de0f6fcbdf
commit 90eae0bc16

@ -297,6 +297,9 @@ impl File {
/// Adds multiple tags to the file at once
#[tracing::instrument(level = "debug", skip(self))]
pub async fn add_tags(&self, tag_ids: Vec<i64>) -> RepoResult<()> {
if tag_ids.is_empty() {
return Ok(());
}
let hash_id = self.hash.id;
let models: Vec<hash_tag::ActiveModel> = tag_ids
.into_iter()

@ -132,7 +132,7 @@ impl Repo {
}
/// Adds a file from bytes to the database
#[tracing::instrument(level = "debug", skip(self))]
#[tracing::instrument(level = "debug", skip(self, content))]
pub async fn add_file(
&self,
mime_type: Option<String>,

@ -13,7 +13,8 @@ use mediarepo_core::utils::parse_namespace_and_tag;
use mediarepo_database::queries::tags::get_hashes_with_namespaced_tags;
use mediarepo_model::file::File;
use std::cmp::Ordering;
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use std::iter::FromIterator;
use tokio::io::AsyncReadExt;
pub struct FilesNamespace;
@ -111,6 +112,7 @@ impl FilesNamespace {
.await?;
file.set_name(metadata.name).await?;
let tags: HashSet<String> = HashSet::from_iter(tags.into_iter());
let tags = repo
.add_all_tags(tags.into_iter().map(parse_namespace_and_tag).collect())
.await?;

Loading…
Cancel
Save