Does Moodle now require slasharguments?

Does Moodle now require slasharguments?

by rob smith -
Number of replies: 4

Hi there,

I upgraded our development site to 3.6.2+ from 3.3.4 the other day and noticed that file links from the WYSIWYG editor are no longer using the ?file= parameter. Yet files in folder activity types are working as intended. If I add ?file= back in to the requested URL the image loads correctly. My investigation lead me to the slasharguments setting, which we've always had disabled. The warning that it will be required in the future makes me wonder if that time has come? If not then I'm not sure why our file URLs are not coming out right.

Example image URLs

1 results in a 404 error) https://domain/pluginfile.php/633/course/section/33/logo%20side.png
2 loads the image correctly) https://domain/pluginfile.php?file=%2F633%2Fcourse%2Foverviewfiles%2Flogo%20side.png

I'm currently working with our hosting company to enable the necessary environment changes to have slasharguments work correctly. Unfortunately that's not going to plan either, but that's for another thread.

Any ideas or suggestions are much appreciated.

Average of ratings: -
In reply to rob smith

Re: Does Moodle now require slasharguments?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I'm not aware of any change to this behaviour... slasharguments has always been required by default but can be switched off. 

See, Using_slash_arguments and also MDL-62640 (which you will notice has not been enacted)

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Does Moodle now require slasharguments?

by rob smith -

Thanks Howard, isn't it a bit odd then that files requested using pluginfile.php are now being served in the wrong way despite having slasharguments disabled? Any idea why our Moodle might be doing this as I've not found anyone else experience a similar issue with these partial symptoms?

If I do enable slasharguments then I get the full symptoms, whereby all resource URLs including CSS are broken. Much like this thread: https://moodle.org/mod/forum/discuss.php?d=373465

In reply to rob smith

Re: Does Moodle now require slasharguments?

by Luis de Vasconcelos -

Do you have any fancy URL Rewrite rules installed on that web server? If so, they might be interfering.

In reply to Luis de Vasconcelos

Re: Does Moodle now require slasharguments?

by rob smith -

Hi Luis,

Thanks for the suggestion but we don't use any URL rewriting as far as I am aware. 

I've traced the issue back to /lib/filelib.php and the file_rewrite_pluginfile_urls function. It appears that the $options['includetoken'] isn't being set by our system for some reason, and that is required for the slasharguments piece to be added on to the base URL correctly.

So I've added an else statement onto the "if (!empty($options['includetoken'])) {" as follows, to fix the issue while we sort out the PATH_INFO environment setting.

} else {
if (!$CFG->slasharguments) {
            $baseurl .= "?file=";
        }
}
Average of ratings: Useful (1)