Commit 34d55890 authored by Shamim Rezaie's avatar Shamim Rezaie
Browse files

Merge branch 'MDL-73121' of https://github.com/paulholden/moodle

parents 6dbfb3bd 47f9106c
......@@ -149,11 +149,12 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || {
_getUsedFiles: function() {
var content = Y.one(window.parent.document.getElementById(this._elementid + 'editable')),
baseUrl = M.cfg.wwwroot + '/draftfile.php/' + this._usercontext + '/user/draft/' + this._itemid + '/',
pattern = new RegExp(baseUrl.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
pattern = new RegExp("[\"']" + baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
filename = '',
match = '',
usedFiles = {};
// The pattern matches any draftfile URL contained within quotes, e.g. 'src="<filename>"' or 'href="<filename>"'.
while ((match = pattern.exec(content.get('innerHTML'))) !== null) {
filename = decodeURIComponent(match[1]);
usedFiles[filename] = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment