Version 4.7.8

This commit is contained in:
Neo committed 2025-12-19 16:10:42 -08:00
1 parent 7b7404e741
commit fd22d99e69
688 files changed
+19814 -10890

No files matched your search

+22 -11
View File
@@ -99,7 +99,7 @@ class _Amazon extends \IPS\File
static::$updatedEndpoint = NULL;
}
if ( ! $values['toggle'] )
if ( empty( $values['toggle'] ) )
{
$values['custom_url'] = NULL;
}
@@ -554,10 +554,12 @@ class _Amazon extends \IPS\File
$r = static::makeRequest( $path, 'POST', $this->configuration, $this->configurationId, NULL, NULL, FALSE, FALSE, array( 'uploads' => '' ) );
$uploadId = (string) $r->decodeXml()->UploadId;
return array(
'path' => $path,
'uploadId' => $uploadId
'path' => $path,
'uploadId' => $uploadId,
'final' => $path,
'original' => $this->originalFilename
);
}
@@ -584,15 +586,16 @@ class _Amazon extends \IPS\File
return $ref;
}
/**
* Finalize a chunked upload
*
* @param mixed $ref The reference for this upload as returned by chunkInit()
* @return string The file's reference which can be passed to \IPS\File::get() as the URL
* @throws \RuntimeException
* @param array $ref The reference for this upload as returned by chunkInit()
* @param string $storageConfiguration Storage configuration name
* @return \IPS\File The file object just created
* @throws \RuntimeException
*/
public function chunkFinish( $ref )
public function chunkFinish( array $ref, string $storageConfiguration ): \IPS\File
{
$xml = \IPS\Xml\SimpleXML::create( 'CompleteMultipartUpload', 'http://s3.amazonaws.com/doc/2006-03-01/' );
foreach ( $ref['etags'] as $partNumber => $eTag )
@@ -601,10 +604,18 @@ class _Amazon extends \IPS\File
$part->addChild( 'ETag', $eTag );
$part->addChild( 'PartNumber', $partNumber );
}
static::makeRequest( $ref['path'], 'POST', $this->configuration, $this->configurationId, $xml->asXML(), NULL, FALSE, NULL, array( 'uploadId' => $ref['uploadId'] ) );
return $ref['path'];
$fileObj = \IPS\File::get( $storageConfiguration, $ref['final'] );
/* This isn't preserved for chunk uploads, so we need to set it so apps can get the real value */
if ( !empty( $ref['original'] ) )
{
$fileObj->originalFilename = $ref['original'];
}
return $fileObj;
}
/**
+5 -1
View File
@@ -950,7 +950,11 @@ abstract class _File
/* Make sure name doesn't have anything that may break URLs */
if ( preg_match( '#[^a-zA-Z0-9!\-_\.\*\(\)\@]#', $filename ) )
{
$filename = mt_rand() . '_' . preg_replace( '#[^a-zA-Z0-9!\-_\.\*\(\)\@]#', '', $filename );
$filename = preg_replace( '#[^a-zA-Z0-9!\-_\.\*\(\)\@]#', '', $filename );
if( !$obscure OR \strlen( pathinfo( $filename, PATHINFO_FILENAME ) ) === 0 )
{
$filename = mt_rand() . '_' . $filename;
}
}
if ( $obscure )
+17 -7
View File
@@ -469,7 +469,7 @@ class _FileSystem extends \IPS\File
$this->setFilename( $filename, $obscure );
$return = array( 'temp' => "{$this->configuration['dir']}/{$tempFolder}/chunk-" . md5( uniqid() ) . '.txt', 'final' => "{$folder}/" . $this->filename );
$return = array( 'temp' => "{$this->configuration['dir']}/{$tempFolder}/chunk-" . md5( uniqid() ) . '.txt', 'final' => "{$folder}/" . $this->filename, 'original' => $this->originalFilename );
touch( $return['temp'] );
return $return;
}
@@ -509,18 +509,28 @@ class _FileSystem extends \IPS\File
return $ref;
}
/**
* Finalize a chunked upload
*
* @param mixed $ref The reference for this upload as returned by chunkInit()
* @return string The file's reference which can be passed to \IPS\File::get() as the URL
* @throws \RuntimeException
* @param array $ref The reference for this upload as returned by chunkInit()
* @param string $storageConfiguration Storage configuration name
* @return \IPS\File The file object just created
* @throws \RuntimeException
*/
public function chunkFinish( $ref )
public function chunkFinish( array $ref, string $storageConfiguration ): \IPS\File
{
rename( $ref['temp'], "{$this->configuration['dir']}/{$ref['final']}" );
return $ref['final'];
$fileObj = \IPS\File::get( $storageConfiguration,$ref['final'] );
/* This isn't preserved for chunk uploads, so we need to set it so apps can get the real value */
if( !empty( $ref['original'] ) )
{
$fileObj->originalFilename = $ref['original'];
}
return $fileObj;
}
/* !File System Utility Methods */
+1 -1
View File
@@ -94,7 +94,7 @@ class _Iterator extends \IteratorIterator implements \Countable
}
}
$fileSize = ( $this->fileSizeField AND !empty( $data[ $this->fileSizeField ] ) ) ? $data[ $this->fileSizeField ] : ( $this->fileSizeField === FALSE ? FALSE : NULL );
$fileSize = ( $this->fileSizeField AND isset( $data[ $this->fileSizeField ] ) ) ? $data[ $this->fileSizeField ] : ( $this->fileSizeField === FALSE ? FALSE : NULL );
$obj = \IPS\File::get( $this->storageExtension, $urlField ? $data[ $urlField ] : $data, $fileSize );
if ( $this->replaceNameField and ! empty( $data[ $this->replaceNameField ] ) )