aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/downloader')
-rw-r--r--crates/shirabe/src/downloader/gzip_downloader.rs5
-rw-r--r--crates/shirabe/src/downloader/phar_downloader.rs4
-rw-r--r--crates/shirabe/src/downloader/tar_downloader.rs4
3 files changed, 7 insertions, 6 deletions
diff --git a/crates/shirabe/src/downloader/gzip_downloader.rs b/crates/shirabe/src/downloader/gzip_downloader.rs
index 4ea8f3b9..6b5f3872 100644
--- a/crates/shirabe/src/downloader/gzip_downloader.rs
+++ b/crates/shirabe/src/downloader/gzip_downloader.rs
@@ -50,14 +50,15 @@ impl GzipDownloader {
}
fn extract_using_ext(&self, file: &str, target_filepath: &str) {
- let archive_file = gzopen(file, "rb");
+ // PHP does not check the gzopen result either; gzread(false, ...) is a fatal TypeError.
+ let archive_file = gzopen(file, "rb").unwrap();
let target_file = fopen(target_filepath, "wb").unwrap();
loop {
let string = gzread(archive_file.clone(), 4096);
if string.is_empty() {
break;
}
- fwrite(&target_file, &string, Some(Platform::strlen(&string)));
+ fwrite(&target_file, &string, Some(string.len() as i64));
}
gzclose(archive_file);
fclose(&target_file);
diff --git a/crates/shirabe/src/downloader/phar_downloader.rs b/crates/shirabe/src/downloader/phar_downloader.rs
index cbbb8252..b33fa74a 100644
--- a/crates/shirabe/src/downloader/phar_downloader.rs
+++ b/crates/shirabe/src/downloader/phar_downloader.rs
@@ -62,8 +62,8 @@ impl ArchiveDownloader for PharDownloader {
path: &str,
) -> anyhow::Result<Option<PhpMixed>> {
// Can throw an UnexpectedValueException
- let archive = Phar::new(file.to_string());
- archive.extract_to(path, None, true);
+ let archive = Phar::new(file.to_string())?;
+ archive.extract_to(path, None, true)?;
// TODO: handle openssl signed phars
// https://github.com/composer/composer/pull/33#issuecomment-2250768
// https://github.com/koto/phar-util
diff --git a/crates/shirabe/src/downloader/tar_downloader.rs b/crates/shirabe/src/downloader/tar_downloader.rs
index dfb825e4..ae600971 100644
--- a/crates/shirabe/src/downloader/tar_downloader.rs
+++ b/crates/shirabe/src/downloader/tar_downloader.rs
@@ -61,8 +61,8 @@ impl ArchiveDownloader for TarDownloader {
file: &str,
path: &str,
) -> anyhow::Result<Option<PhpMixed>> {
- let archive = PharData::new(file.to_string());
- archive.extract_to(path, None, true);
+ let archive = PharData::new(file.to_string())?;
+ archive.extract_to(path, None, true)?;
Ok(None)
}