Skip to content
Browse files

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

…ad non-image files
  • Loading branch information...
1 parent 7952a76 commit 4342b9320dcf2f8420234e91fd47da081de9db2d @mnoorenberghe mnoorenberghe committed with Sam Hemelryk Sep 5, 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 4342b93

Please sign in to comment.
Something went wrong with that request. Please try again.