BUGFIX HTMLEditorField->saveInto() can now find images with urlencoded information for resample (e.g. spaces in filenames)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100985 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-03-13 23:19:05 +00:00 committed by Sam Minnee
parent 3f3c2b2fe9
commit fcfd1f7d5b

View File

@ -104,8 +104,7 @@ class HtmlEditorField extends TextareaField {
if($images = $htmlValue->getElementsByTagName('img')) foreach($images as $img) {
// strip any ?r=n data from the src attribute
$img->setAttribute('src', preg_replace('/([^\?]*)\?r=[0-9]+$/i', '$1', $img->getAttribute('src')));
if(!$image = File::find($path = Director::makeRelative($img->getAttribute('src')))) {
if(!$image = File::find($path = urldecode(Director::makeRelative($img->getAttribute('src'))))) {
if(substr($path, 0, strlen(ASSETS_DIR) + 1) == ASSETS_DIR . '/') {
$record->HasBrokenFile = true;
}