Skip to content

Commit

Permalink
Merge branch 'MDL-73121' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed Jun 28, 2022
2 parents 6dbfb3b + 47f9106 commit 34d5589
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,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;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 34d5589

Please sign in to comment.