If variable_get('file_default_scheme', 'public') == 'private' then video thumbnails don't work.

Comments

dalin’s picture

Status: Active » Needs review
StatusFileSize
new852 bytes

At first I found #1420812: Files from private stream cannot be downloaded. I was going to write an implementation of hook_file_download() that would work with that patch that would basically ignore access control and always show the thumbnail. But on further thought it seems to make more sense to simply always use the public file system. There's no need to hide a public YouTube thumbnail.

David_Rothstein’s picture

This makes sense to me for the vast majority of use cases.

I wonder if there are situations where keeping it private matters though? (Because if the file is public and someone knows the URL then in theory they can figure out what kinds of YouTube videos you are sharing on your site - maybe some sites would consider that sensitive information).

dalin’s picture

theory they can figure out what kinds of YouTube videos you are sharing on your site

This is not correct, since for example if you use the media browser YouTube tab to do a search for 'foo', you'll now have thumbnails for the first 10 search results. You just searched for a term, your site may or may not actually use the video.

David_Rothstein’s picture

Ah, good point. Well I guess the best they can do in that case is figure out what kinds of YouTube videos people are thinking about sharing on the site :)

aaron’s picture

Status: Needs review » Reviewed & tested by the community

This works as advertised. I'll commit this tomorrow. Thanks a lot, dalin.

aaron’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks for the work, dalin.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

socialnicheguru’s picture

Issue summary: View changes
Status: Closed (fixed) » Reviewed & tested by the community

While this was committed, it is not in the current dev branch:

Feb 6 media_youtube-7.2.x

function getLocalThumbnailPath() {
    $parts = $this->get_parameters();
    $local_path = file_default_scheme() . '://media-youtube/' . check_plain($parts\
['v']) . '.jpg';
    if (!file_exists($local_path)) {
      $dirname = drupal_dirname($local_path);
      file_prepare_directory($dirname, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISS\
IONS);
      $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);
      }

but committed here:
http://drupalcode.org/project/media_youtube.git/commitdiff/c53660cde8c7d...

aaron’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.