Problem/Motivation
When enabling the file logging, it will not write any files. When having created the needed directories manually, it will actually fail, because it will use the description string as a filename practically as-is. The description for requests will be something like Response cache tags for GET /my/pages/url. The createFilename function will do some sanitization, but it does not take into account the slashes. Although the method's name might imply it does more to produce a valid filename, the description says: "Creates a full file path from a directory and filename. If a file with the specified name already exists, an alternative will be used." So, nothing there to imply it does any sanitization.
Steps to reproduce
- Enable the module
- Enable file logging
- Do a request, notice no log file is created
- Create a directory cache_debug/response in the private file location
- Do a request, notice how it fails
Proposed resolution
Sanitize the filename.
Remaining tasks
Create MR
Review
Merge
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork cache_debug-3605673
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
eelkeblokComment #4
eelkeblokUsing cleanCssIdentifier felt a little dirty, but it does the job and I couldn't find anything more appropriate. Reinventing the wheel by doing my own escaping seemed not worth it either.
Comment #6
matthijsSorry for the long wait... Your changes were merged, thanks!