Repository navigation
Conversation
|
I notice that the error messages use the same list in lots of different locations:
I was wondering if it would be worth centralizing that list in case that list were to ever change. Though due to translations (the start of the message isn't always the same), that might just cause other problems. Just a thought. |
|
Those messages are now generated by utility methods in |
b5e4bc1 to
637fa6d
Compare
|
Yeah, I saw that as well. That is an existing issue even with the current release (the main branch). So I left it for now. |
9397c34 to
f0ecf00
Compare
Instead of each module deciding what a safe path or a valid file name
is, frequently in slightly different ways, use the new `pathIsSafe`,
`fileNameIsValid`, and `filePathIsValid` methods and the existing
`pathIsSubdir` method (renamed from the `path_is_subdir` method to match
camel casing used by other methods in the file) in `WeBWorK::Utils::Files`.
`isAchievementAssetSafe` was removed from the `WeBWorK::Utils::Achievements`
package.
The names of new files and directories are now validated the same way
everywhere. Names may contain letters, digits, spaces, and the characters
"-", "_", ".", "+", ",", "(", ")", and "~", and may not start with a
period. Paths to existing files are only checked to not contain ".."
directories. Files whose names start with a period are no longer
extracted from archives in the file manager.
SendMail also now checks the message and merge file names before saving
them as settings, and only reports that a message was saved if the file
was actually written.
Add `fileNameRequirementsMessage` and `filePathRequirementsMessage` methods to `WeBWorK::Utils::Files` so that the description of what a valid name or path is lives next to `fileNameIsValid` and `filePathIsValid`, instead of being duplicated everywhere it is reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f0ecf00 to
861b757
Compare

Instead of each module deciding what a safe path or a valid file name is, frequently in slightly different ways, use the new
pathIsSafe,fileNameIsValid, andfilePathIsValidmethods and the existingpathIsSubdirmethod (renamed from thepath_is_subdirmethod to match camel casing used by other methods in the file) inWeBWorK::Utils::Files.isAchievementAssetSafewas removed from theWeBWorK::Utils::Achievementspackage.The names of new files and directories are now validated the same way everywhere. Names may contain letters, digits, spaces, and the characters "-", "_", ".", "+", ",", "(", ")", and "~", and may not start with a period. Paths to existing files are only checked to not contain ".." directories. Files whose names start with a period are no longer extracted from archives in the file manager.
SendMail also now checks the message and merge file names before saving them as settings, and only reports that a message was saved if the file was actually written.