Index: filefield_paths.module =================================================================== --- filefield_paths.module (revision 233) +++ filefield_paths.module (working copy) @@ -281,16 +281,17 @@ */ function _filefield_paths_replace_path($old, $new, $entity) { // Build regular expression. - $info = parse_url(file_stream_wrapper_uri_normalize($old)); - $info['path'] = !empty($info['path']) ? $info['path'] : ''; - $absolute = str_replace("{$info['host']}{$info['path']}", '', file_create_url($old)); + $info = parse_url(file_create_url(file_stream_wrapper_uri_normalize($old))); + if(empty($info['path'])) + $info['path'] = ''; + $absolute = str_replace($info['path'], '', file_create_url($old)); $relative = parse_url($absolute, PHP_URL_PATH); - $regex = str_replace('/', '\/', "({$absolute}|{$relative}|{$info['scheme']}://)(styles/.*?/{$info['scheme']}/|)({$info['host']}{$info['path']})"); + $regex = str_replace('/', '\/', "($absolute|$relative)(styles/.*?/|)({$info['path']})"); // Build replacement. - $info = parse_url(file_stream_wrapper_uri_normalize($new)); + $info = parse_url(file_create_url(file_stream_wrapper_uri_normalize($new))); $info['path'] = !empty($info['path']) ? $info['path'] : ''; - $replacement = "_filefield_paths_replace_path_uri_scheme('\\1', '{$old}', '{$new}') . '\\2{$info['host']}{$info['path']}'"; + $replacement = "_filefield_paths_replace_path_uri_scheme('\\1', '$old', '$new') . '\\2{$info['path']}'"; $fields = field_info_fields(); foreach ($fields as $name => $field) {