diff --git a/filefield_paths.module b/filefield_paths.module index e641ab0..53df161 100644 --- a/filefield_paths.module +++ b/filefield_paths.module @@ -382,3 +382,18 @@ function _filefield_paths_get_field_types($reset = FALSE) { return $field_types; } + +/** + * Check if a uri is considered local or not. + * + * @param string $uri + * A file uri. + * + * @return + * TRUE if the uri is using a local stream wrapper, or FALSE otherwise. + */ +function filefield_paths_uri_is_local($uri) { + $scheme = file_uri_scheme($uri); + $wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_LOCAL); + return !empty($wrappers[$scheme]) && empty($wrappers[$scheme]['remote']); +} diff --git a/modules/filefield_paths.inc b/modules/filefield_paths.inc index 6e8eefc..4bf6abd 100644 --- a/modules/filefield_paths.inc +++ b/modules/filefield_paths.inc @@ -45,6 +45,9 @@ function filefield_paths_filefield_paths_process_file($type, $entity, $field, $i if (isset($instance['settings']['filefield_paths'])) { $settings = $instance['settings']['filefield_paths']; foreach ($items as &$file) { + if (!filefield_paths_uri_is_local($file['uri'])) { + break; + } if ($file['timestamp'] == REQUEST_TIME || $settings['active_updating']) { $token_data = array( 'file' => (object) $file,