Commit c4f55523 authored by git's avatar git Committed by Marco Villegas
Browse files

Issue #2064329 by nbourdial: Checks thumbnail url before storing it.

parent 28b8b844
Loading
Loading
Loading
Loading
+6 −0
Changes for includes/MediaDailymotionStreamWrapper.inc: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -35,8 +35,14 @@ class MediaDailymotionStreamWrapper extends MediaReadOnlyStreamWrapper {
    if (!file_exists($local_path)) {
      $dirname = drupal_dirname($local_path);
      file_prepare_directory($dirname, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
      $response = drupal_http_request($this->getOriginalThumbnailPath());
      if (!isset($response->error)) {
        file_unmanaged_save_data($response->data, $local_path, TRUE);
      }
      else {
        @copy($this->getOriginalThumbnailPath(), $local_path);
      }
    }
    return $local_path;
  }
}