Rename GzipArchive to Gzip

master
Edward Shen 2022-01-15 21:34:52 -08:00
parent 3cb95a9f04
commit 8a09da764e
Signed by: edward
GPG Key ID: 19182661E818369F
1 changed files with 5 additions and 5 deletions

View File

@ -111,7 +111,7 @@ pub fn decrypt(
entries.sort_by(|a, b| a.name.cmp(&b.name)); entries.sort_by(|a, b| a.name.cmp(&b.name));
DecryptedData::Archive(blob, entries) DecryptedData::Archive(blob, entries)
} }
ContentType::GzipArchive => { ContentType::Gzip => {
let mut entries = vec![]; let mut entries = vec![];
let cursor = Cursor::new(container); let cursor = Cursor::new(container);
let gzip_dec = flate2::read::GzDecoder::new(cursor); let gzip_dec = flate2::read::GzDecoder::new(cursor);
@ -136,7 +136,7 @@ pub fn decrypt(
} else { } else {
DecryptedData::Blob(blob) DecryptedData::Blob(blob)
} }
}, }
ContentType::Unknown => DecryptedData::Blob(blob), ContentType::Unknown => DecryptedData::Blob(blob),
}; };
@ -150,7 +150,7 @@ enum ContentType {
Audio, Audio,
Video, Video,
ZipArchive, ZipArchive,
GzipArchive, Gzip,
Unknown, Unknown,
} }
@ -188,7 +188,7 @@ impl<T: AsRef<[u8]>> ContentTypeExt for T {
} else if mime_type == "application/zip" { } else if mime_type == "application/zip" {
ContentType::ZipArchive ContentType::ZipArchive
} else if mime_type == "application/gzip" { } else if mime_type == "application/gzip" {
ContentType::GzipArchive ContentType::Gzip
} else { } else {
ContentType::Unknown ContentType::Unknown
} }
@ -221,7 +221,7 @@ mod content_type {
test_content_type!(mp4_is_video, "movie.mp4", ContentType::Video); test_content_type!(mp4_is_video, "movie.mp4", ContentType::Video);
test_content_type!(mkv_is_video, "movie.mkv", ContentType::Video); test_content_type!(mkv_is_video, "movie.mkv", ContentType::Video);
test_content_type!(zip_is_zip, "archive.zip", ContentType::ZipArchive); test_content_type!(zip_is_zip, "archive.zip", ContentType::ZipArchive);
test_content_type!(gzip_is_gzip, "image.png.gz", ContentType::GzipArchive); test_content_type!(gzip_is_gzip, "image.png.gz", ContentType::Gzip);
test_content_type!(binary_is_unknown, "omegaupload", ContentType::Unknown); test_content_type!(binary_is_unknown, "omegaupload", ContentType::Unknown);
test_content_type!(pgp_is_text, "text.pgp", ContentType::Text); test_content_type!(pgp_is_text, "text.pgp", ContentType::Text);
} }