Skip to content

Commit

Permalink
Local zip file
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc45 committed Mar 13, 2024
1 parent c5f73be commit 4f281c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/src/Environment/ExtensionDownload/ExtensionZip.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public function extract_zip( string $zip_file, string $extract_to ): void {
}
}

// Make sure $extract_to is within Config Dir.
if ( strpos( normalize_path( $extract_to ), Config::get_qit_dir() ) !== 0 ) {
// Make sure $extract_to is within Config Dir or sys_get_temp_dir.
if ( strpos( normalize_path( $extract_to ), Config::get_qit_dir() ) !== 0 && strpos( normalize_path( $extract_to ), normalize_path( sys_get_temp_dir() ) ) !== 0 ) {
throw new \RuntimeException( 'Invalid directory.' );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ protected function find_type_in_zip( Extension $extension ): void {
$tmp_dir = sys_get_temp_dir() . '/' . uniqid( 'qit-cli-' );

// Make tmp dir.
if ( ! mkdir( $tmp_dir, 0777, true ) ) {
if ( ! mkdir( $tmp_dir, 0755, true ) ) {
throw new \RuntimeException( 'Could not create temporary directory: ' . $tmp_dir );
}

App::make( ExtensionZip::class )->extract_zip( $extension->path, $tmp_dir );
$ext_copy = clone $extension;
$ext_copy->path = $tmp_dir;
$ext_copy = clone $extension;
$ext_copy->extension_identifier = $tmp_dir;
$this->find_type_in_dir( $ext_copy );
}
}

0 comments on commit 4f281c0

Please sign in to comment.