@@ -29,7 +29,6 @@ use lettre_email::PartBuilder;
2929use rusqlite:: OptionalExtension ;
3030use serde:: { Deserialize , Serialize } ;
3131use serde_json:: Value ;
32- use tokio:: io:: AsyncReadExt ;
3332
3433use crate :: chat:: { self , Chat } ;
3534use crate :: constants:: Chattype ;
@@ -195,7 +194,7 @@ fn find_zip_entry<'a>(
195194 name : & str ,
196195) -> Option < ( usize , & ' a async_zip:: StoredZipEntry ) > {
197196 for ( i, ent) in file. entries ( ) . iter ( ) . enumerate ( ) {
198- if ent. entry ( ) . filename ( ) == name {
197+ if ent. filename ( ) . as_bytes ( ) == name. as_bytes ( ) {
199198 return Some ( ( i, ent) ) ;
200199 }
201200 }
@@ -212,7 +211,7 @@ impl Context {
212211 return Ok ( false ) ;
213212 }
214213
215- let archive = match async_zip:: read:: mem:: ZipFileReader :: new ( file. to_vec ( ) ) . await {
214+ let archive = match async_zip:: base :: read:: mem:: ZipFileReader :: new ( file. to_vec ( ) ) . await {
216215 Ok ( archive) => archive,
217216 Err ( _) => {
218217 info ! ( self , "{} cannot be opened as zip-file" , & filename) ;
@@ -235,7 +234,7 @@ impl Context {
235234 bail ! ( "{} is not a valid webxdc file" , filename) ;
236235 }
237236
238- let valid = match async_zip:: read:: fs:: ZipFileReader :: new ( path) . await {
237+ let valid = match async_zip:: tokio :: read:: fs:: ZipFileReader :: new ( path) . await {
239238 Ok ( archive) => {
240239 if find_zip_entry ( archive. file ( ) , "index.html" ) . is_none ( ) {
241240 warn ! ( self , "{} misses index.html" , filename) ;
@@ -791,12 +790,15 @@ fn parse_webxdc_manifest(bytes: &[u8]) -> Result<WebxdcManifest> {
791790 Ok ( manifest)
792791}
793792
794- async fn get_blob ( archive : & async_zip:: read:: fs:: ZipFileReader , name : & str ) -> Result < Vec < u8 > > {
793+ async fn get_blob (
794+ archive : & async_zip:: tokio:: read:: fs:: ZipFileReader ,
795+ name : & str ,
796+ ) -> Result < Vec < u8 > > {
795797 let ( i, _) = find_zip_entry ( archive. file ( ) , name)
796798 . ok_or_else ( || anyhow ! ( "no entry found for {}" , name) ) ?;
797- let mut reader = archive. entry ( i) . await ?;
799+ let mut reader = archive. reader_with_entry ( i) . await ?;
798800 let mut buf = Vec :: new ( ) ;
799- reader. read_to_end ( & mut buf) . await ?;
801+ reader. read_to_end_checked ( & mut buf) . await ?;
800802 Ok ( buf)
801803}
802804
@@ -806,12 +808,12 @@ impl Message {
806808 async fn get_webxdc_archive (
807809 & self ,
808810 context : & Context ,
809- ) -> Result < async_zip:: read:: fs:: ZipFileReader > {
811+ ) -> Result < async_zip:: tokio :: read:: fs:: ZipFileReader > {
810812 let path = self
811813 . get_file ( context)
812814 . ok_or_else ( || format_err ! ( "No webxdc instance file." ) ) ?;
813815 let path_abs = get_abs_path ( context, & path) ;
814- let archive = async_zip:: read:: fs:: ZipFileReader :: new ( path_abs) . await ?;
816+ let archive = async_zip:: tokio :: read:: fs:: ZipFileReader :: new ( path_abs) . await ?;
815817 Ok ( archive)
816818 }
817819
0 commit comments