Permalink
Browse files

BUGFIX HTMLEditorField->saveInto() can now find images with urlencode…

…d information for resample (e.g. spaces in filenames) (from r100985)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111557 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 2e66aff commit 5f0fcc58ecdbbe36c5e2d55b9bda42c4a11439a3 @sminnee sminnee committed Oct 4, 2010
Showing with 1 addition and 2 deletions.
  1. +1 −2 forms/HtmlEditorField.php
@@ -104,8 +104,7 @@ public function saveInto($record) {
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;
}

0 comments on commit 5f0fcc5

Please sign in to comment.