Permalink
Browse files

MDL-41634 - URL Download Repository doesn't warn when asked to downlo…

…ad non-image files
  • Loading branch information...
1 parent b69ec28 commit 9b3d60fc47e4db8956174a600a7c21b0ea453f86 @mnoorenberghe mnoorenberghe committed Sep 6, 2013
Showing with 3 additions and 0 deletions.
  1. +1 −0 repository/url/lang/en/repository_url.php
  2. +2 −0 repository/url/lib.php
View
1 repository/url/lang/en/repository_url.php
@@ -30,3 +30,4 @@
$string['url:view'] = 'Use URL downloader in file picker';
$string['validname'] = 'You must provide a valid file name';
$string['configplugin'] = 'URL repository type configuration';
+$string['validfiletype'] = 'You must provide a URL to an image file or a page containing images.';
View
2 repository/url/lib.php
@@ -168,6 +168,8 @@ protected function parse_file($baseurl, $relativeurl, &$list, $mainfile = false)
} else if (strstr($info['content_type'], 'image/')) {
// download this file
$this->add_image_to_list($info['url'], $info['url'], $list);
+ } else {
+ $list['error'] = get_string('validfiletype', 'repository_url');
}
// parse all found css styles

0 comments on commit 9b3d60f

Please sign in to comment.