forked from jmug/stoatchat
feat(services/autumn): strip exif data for images/videos
feat(services/autumn): hash files and log information
This commit is contained in:
@@ -19,21 +19,6 @@ static SUPPORTED_IMAGE_MIME: [&str; 9] = [
|
||||
"image/webp",
|
||||
];
|
||||
|
||||
/// Image mime types that have EXIF data
|
||||
static IMAGE_MIMES_WITH_EXIF: [&str; 4] = ["image/avif", "image/jpeg", "image/jxl", "image/tiff"];
|
||||
|
||||
/// Get the size of a temp file
|
||||
pub fn temp_file_size(f: &NamedTempFile) -> Result<u64> {
|
||||
// Check the size of the file
|
||||
if let Ok(file) = f.reopen() {
|
||||
if let Ok(metadata) = file.metadata() {
|
||||
return Ok(metadata.size());
|
||||
}
|
||||
}
|
||||
|
||||
Err(create_error!(InternalError))
|
||||
}
|
||||
|
||||
/// Generate metadata from file, using mime type as a hint
|
||||
pub fn generate_metadata(f: &NamedTempFile, mime_type: &str) -> Metadata {
|
||||
if SUPPORTED_IMAGE_MIME.contains(&mime_type) {
|
||||
|
||||
Reference in New Issue
Block a user