-
-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MODX resources can be "saved" without a pagetitle #14564
Comments
The bug, as it turned out, is still relevant for Templates, Categories and Files. You can create them with spaces instead of a name (for a file there will be, for example: " .txt"). |
For MODX3, this problem is also relevant, although for resources the bug works slightly differently. |
Please ignore the referenced pull above (#15146) ... I jumped the gun, so to speak, when replying that it addressed this particular issue. I removed my comment, but the pull reference remains. |
OK, I'm going to jump in and work up a solution. One question: Should there ever be an instance where a resource, element, or file name is allowed to begin with white space? My feeling is no. The answer to this question may inform how to go about making the change. |
As I work on this, I find myself questioning the usefulness of auto-generating the "Untitled Resource" title and alias to begin with (at least in the way it currently happens). As I play with it (in both 2.x and 3.x), it seems to only apply when you happen to enter only whitespace into the pagetitle field. (Forgive me if I'm missing something in that regard.) As one would expect, an initially-empty field generates a validation error. So why would this not be the case for what is programatically-empty (i.e., only spaces)? Note that I realize there's a nuance in resource naming in that there's a use-case for allowing "0" as a pagetitle/alias, which is why the processors should test for null or an empty string rather than using php empty(). If the intention is to allow the saving of one or more untitled documents, then I'd argue it needs to be gone about in a different and more predictable way. Brainstorming it a bit, maybe ...
What do you all think? If this functionality is warranted, I'd consider it more of a near-future enhancement and just fix the buggy behavior at this point. |
For 2.x we should fix the buggy behavior, in 3.x we can improve the behavior if needed. |
In general, for the 2.x branch, I made a solution, but only for resources #14800 Although there is a problem for elements and files. |
I'd be okay with preventing the empty pagetitle from being used in create (noting the special behavior when a resource is reloaded pre-save for switching templates) but don't really have too many strong feelings on the topic. |
Bug report
Summary
MODX resources can be "saved" without a pagetitle
Step to reproduce
Observed behavior
Resource is saved with no pagetitle
Expected behavior
User should be prompted to enter a pagetitle with real text (not just spaces) before being able to save.
Environment
MODX version, apache/nginx and version, mysql version, browser, etc. Any relevant information.
MODX 2.7.1
The text was updated successfully, but these errors were encountered: