--- insert.module +++ insert.module @@ -369,13 +369,21 @@ function theme_insert_field_widget_settings_styles($variables) { * setting. */ function insert_create_url($uri) { - // This variable has no configuration location. It may be set by placing - // $conf['insert_absolute_paths'] = FALSE; - // in the site settings.php file, or by manually running variable_set(). - // For reasons why this might not do what you want and why there's no UI - // see http://drupal.org/node/640352. - $absolute = variable_get('insert_absolute_paths', TRUE); - + $url = parse_url($uri); + if ($url['scheme'] == 'public') { + // This variable has no configuration location. It may be set by placing + // $conf['insert_absolute_paths'] = FALSE; + // in the site settings.php file, or by manually running variable_set(). + // For reasons why this might not do what you want and why there's no UI + // see http://drupal.org/node/640352. + $absolute = variable_get('insert_absolute_paths', TRUE); + if (!$absolute) { + $uri = file_create_url($uri); + $url = parse_url($uri); + return $url['path']; + } + } + // TODO: Rewrite this function to support relative paths? Tricky because // not all stream wrappers support local paths at all. return file_create_url($uri);