diff --git a/docroot/sites/all/modules/contrib/media_youtube/includes/MediaInternetYouTubeHandler.inc b/docroot/sites/all/modules/contrib/media_youtube/includes/MediaInternetYouTubeHandler.inc index fbc92ec..d93af55 100644 --- a/docroot/sites/all/modules/contrib/media_youtube/includes/MediaInternetYouTubeHandler.inc +++ b/docroot/sites/all/modules/contrib/media_youtube/includes/MediaInternetYouTubeHandler.inc @@ -28,28 +28,19 @@ class MediaInternetYouTubeHandler extends MediaInternetBaseHandler { } } - public function validate() { - // @todo Media module currently fails when two files try to have the same - // URI, so catch that in the validation step. Some day, it would be nice - // to allow it, however. See http://drupal.org/node/952422. - $uri = $this->parse($this->embedCode); - $existing_files = file_load_multiple(array(), array('uri' => $uri)); - if (count($existing_files)) { - throw new MediaInternetValidationException(t('You have entered a URL for a video that is already in your library.')); - } - } - public function save() { $file = $this->getFileObject(); + // If a user enters a duplicate YouTube URL, the object will be saved again. + // Set the timestamp to the current time, so that the media item shows up + // at the top of the media library, where they would expect to see it. + $file_obj->timestamp = REQUEST_TIME; file_save($file); return $file; } public function getFileObject() { $uri = $this->parse($this->embedCode); - //@todo: this is terribly broken in some ways because the function is really - // made for local files which are 'real' - return file_uri_to_object($uri); + return file_uri_to_object($uri, TRUE); } /**