Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'MDL-37934_23' of git://github.com/jmvedrine/moodle into…

… MOODLE_23_STABLE
  • Loading branch information...
commit c3724a7002afef08eba97d4564a300f7b4ada104 2 parents 15cc42f + a56ced7
Dan Poltawski danpoltawski authored

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. +3 2 question/format/blackboard_six/formatbase.php
5 question/format/blackboard_six/formatbase.php
@@ -123,15 +123,16 @@ public function text_field($text) {
123 123 $data = array();
124 124 // Step one, find all file refs then add to array.
125 125 preg_match_all('|<img[^>]+src="([^"]*)"|i', $text, $out); // Find all src refs.
126   -
  126 + $filepaths = array();
127 127 foreach ($out[1] as $path) {
128 128 $fullpath = $this->filebase . '/' . $path;
129 129
130   - if (is_readable($fullpath)) {
  130 + if (is_readable($fullpath) && !in_array($path, $filepaths)) {
131 131 $dirpath = dirname($path);
132 132 $filename = basename($path);
133 133 $newfilename = $this->store_file_for_text_field($data, $this->filebase, $dirpath, $filename);
134 134 $text = preg_replace("|$path|", "@@PLUGINFILE@@/" . $newfilename, $text);
  135 + $filepaths[] = $path;
135 136 }
136 137
137 138 }

0 comments on commit c3724a7

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