Repository navigation
Conversation
Contributor
|
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. |
Member
Author
|
Those messages are now generated by utility methods in |
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>
drgrice1
force-pushed
the
path-handling-rework
branch
from
November 22, 2026 18:53
b5e4bc1 to
637fa6d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.