1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-06 16:16:39 +02:00

allow space in image filename by default, fix #91

This commit is contained in:
Mikael Roos
2015-04-28 14:22:38 +02:00
parent 2651c9ea02
commit 0c0b5ef672
6 changed files with 11 additions and 10 deletions

View File

@@ -8,6 +8,7 @@ Revision history
v0.7.0.x (latest)
-------------------------------------
* Allow space in filename by using `urlencode()` and allow space as valid filenam character. fix 91.
* Support redirections for remote images, fix #87, fix #90.
* Improving usage of Travis and Scrutinizer.
* Naming cache-file using md5 for remote images, fix #86.

View File

@@ -340,13 +340,13 @@ if (isset($shortcut)
/**
* src - the source image file.
*/
$srcImage = get('src')
$srcImage = urldecode(get('src'))
or errorPage('Must set src-attribute.');
// Check for valid/invalid characters
$imagePath = getConfig('image_path', __DIR__ . '/img/');
$imagePathConstraint = getConfig('image_path_constraint', true);
$validFilename = getConfig('valid_filename', '#^[a-z0-9A-Z-/_\.:]+$#');
$validFilename = getConfig('valid_filename', '#^[a-z0-9A-Z-/_ \.:]+$#');
preg_match($validFilename, $srcImage)
or errorPage('Filename contains invalid characters.');

View File

@@ -94,10 +94,10 @@ return array(
* A regexp for validating characters in the image or alias filename.
*
* Default value:
* valid_filename: '#^[a-z0-9A-Z-/_\.:]+$#'
* valid_filename: '#^[a-z0-9A-Z-/_ \.:]+$#'
* valid_aliasname: '#^[a-z0-9A-Z-_]+$#'
*/
//'valid_filename' => '#^[a-z0-9A-Z-/_\.:]+$#',
//'valid_filename' => '#^[a-z0-9A-Z-/_ \.:]+$#',
//'valid_aliasname' => '#^[a-z0-9A-Z-_]+$#',

View File

@@ -3382,13 +3382,13 @@ if (isset($shortcut)
/**
* src - the source image file.
*/
$srcImage = get('src')
$srcImage = urldecode(get('src'))
or errorPage('Must set src-attribute.');
// Check for valid/invalid characters
$imagePath = getConfig('image_path', __DIR__ . '/img/');
$imagePathConstraint = getConfig('image_path_constraint', true);
$validFilename = getConfig('valid_filename', '#^[a-z0-9A-Z-/_\.:]+$#');
$validFilename = getConfig('valid_filename', '#^[a-z0-9A-Z-/_ \.:]+$#');
preg_match($validFilename, $srcImage)
or errorPage('Filename contains invalid characters.');

View File

@@ -3382,13 +3382,13 @@ if (isset($shortcut)
/**
* src - the source image file.
*/
$srcImage = get('src')
$srcImage = urldecode(get('src'))
or errorPage('Must set src-attribute.');
// Check for valid/invalid characters
$imagePath = getConfig('image_path', __DIR__ . '/img/');
$imagePathConstraint = getConfig('image_path_constraint', true);
$validFilename = getConfig('valid_filename', '#^[a-z0-9A-Z-/_\.:]+$#');
$validFilename = getConfig('valid_filename', '#^[a-z0-9A-Z-/_ \.:]+$#');
preg_match($validFilename, $srcImage)
or errorPage('Filename contains invalid characters.');

View File

@@ -3382,13 +3382,13 @@ if (isset($shortcut)
/**
* src - the source image file.
*/
$srcImage = get('src')
$srcImage = urldecode(get('src'))
or errorPage('Must set src-attribute.');
// Check for valid/invalid characters
$imagePath = getConfig('image_path', __DIR__ . '/img/');
$imagePathConstraint = getConfig('image_path_constraint', true);
$validFilename = getConfig('valid_filename', '#^[a-z0-9A-Z-/_\.:]+$#');
$validFilename = getConfig('valid_filename', '#^[a-z0-9A-Z-/_ \.:]+$#');
preg_match($validFilename, $srcImage)
or errorPage('Filename contains invalid characters.');