For example, "A Response From John Doe" yields "-response-john-doe" instead of "response-john-doe"
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | 326503-pathauto-empty-separator-D6-1.patch | 1.6 KB | dave reid |
| #26 | 326503-pathauto-empty-separator-D6-2.patch | 1.58 KB | dave reid |
| #24 | 326503-pathauto-empty-separator-D6-2.patch | 1.58 KB | dave reid |
| #24 | 326503-pathauto-empty-separator-D6-1.patch | 1.59 KB | dave reid |
| #17 | tests_for_separators.patch | 951 bytes | greggles |
Comments
Comment #1
gregglesMarked #333518: remove hyphen from beginning of a token _after_ removal of "words to remove" as a duplicate.
I think this is a regression that we fixed somewhere and has now come back, but maybe not...
Maybe it only impacts the "*path" and "*alias" tokens?
Comment #2
aaronshaf commentedIt's still a problem.
Comment #3
aaronshaf commentedHow is this coming along? It's still a huge problem for a very large site I'm working on.
Comment #4
gregglesWhen I work on things I assign the issue myself using the "Assigned" field. So, I'm not working on this. Perhaps you could fix it and provide a patch?
Comment #5
gregglesMarked #346514: Filtered Words cause improper url as a duplicate.
Comment #6
nonsieI've managed to track this issue down to using terms in aliases. It does not affect other tokens.
A cheap hack around it is to use the following in pathauto_cleanstring() right after replacing multiple separators with one:
This is not a fix but a way around until a proper fix is found.
Comment #7
greggles@nonsie - why do you say this is not a proper fix?
EDIT: not a proper fix...
Comment #8
gregglesMarked #462148: Seperator remains around slashes after stop words removed as a duplicate. It has a similar preg_replace solution in http://drupal.org/files/issues/pathauto-stopword-slash_1.patch
Comment #9
damienmckennaWould the best solution not be to remove the separator from both the beginning and end of the string so we're also then not left with "sentences that begin with the" turning into "sentences-that-begin-with-".
Comment #10
dave reidYes, and since the separator is only one character, we should use the awesomeness of trim($string, $separator) instead of preg.
Comment #11
damienmckennaSo, list of scenarios that need to be covered:
Comment #12
damienmckennadavereid: Given the variable can be controlled directly using variable_set() or $conf[] (in settings.php) to be anything the developer wants, we can't rely on just using the trim() function.
Comment #13
damienmckennaComment #14
damienmckennaThe current CVS already has the following line:
so half of our problem is already solved.
(note: the comment was chopped off by whoever committed the change)
I've rerolled and attached johnpitcairn's 6.x-1.x patch from #462148: Seperator remains around slashes after stop words removed.
Comment #15
damienmckennajohnpitcairn's patch rerolled for v6.x-2.x.
Comment #16
gregglesCommitted to 6.x-1.x and 6.x-2.x
http://drupal.org/cvs?commit=277280
http://drupal.org/cvs?commit=277284
Thanks johnpitcairn, DamienMcKenna!
Comment #17
gregglesHow about some tests for this as well, eh?
Comment #18
gregglesIt seems like this introduced a new problem: #612232: Unknown modifier '|' in pathauto.inc on line 206.. Any chance someone can look into it?
Comment #19
damienmckennaCould someone please provide an example 'pathauto_separator' value that causes this to happen?
Comment #20
dave reidMaybe just try always escaping the separator?
Comment #21
dave reidMarked #612786: warning: preg_replace() [function.preg-replace]: Unknown modifier '|' error as a duplicate of this.
Comment #22
dave reidHelpful information from those of you experiencing this issue:
1. What kind of path patterns are you using for the items causing this issue?
2. What was the result generated alias from the items that experienced this issue?
3. What separator are you using (from Pathauto's general settings)?
Comment #23
spazfoxDave,
Here are my answers for the problem I described in http://drupal.org/node/612786 (which I now see is a duplicate of some issues above!):
1. I only have three path patterns specified for the site: the default path pattern is "[title-raw]," one content type has "sometext[nid]," and another content type has "sometext[field_cckfield-raw]." The others are left blank. The error is occurring on the editing or creation of all content types, however.
2. URL aliases are not being created for any content types that result in this error (which is all of them!); content is created with the standard "node/nid" format
3. I am using nothing as the separator
Hope that helps and let me know if I can provide any further helpful information.
Comment #24
dave reidOk I can confirm this bug when using an empty separator. Patches for both 2.x and 1.x that checks if strlen($separator) so that separators like '0' can work, although that would be weird. Also, the convert-to-lower-case was inside the $separator block, so if there was an empty separator, that wouldn't be executed, so I moved it outside that block.
Comment #25
gregglesThanks for your investigation.
The changes seem good to me. Lowering priority for this, and I don't plan to make a new dot release just for this feature.
Comment #26
dave reidPatches without the stupid comment this time.
Comment #27
dave reidComment #28
spazfoxThanks for the quick fix!
The patch has eliminated this error, but a new problem has surfaced: auto aliasing is not working now for my content type that has the path "sometext[nid]". Could this be related to the patch, or should I investigate other possible problems and file a new issue if necessary?
Comment #29
spazfoxSince my "sometext[nid]" automatic path worked fine before this patch and stopped working after I applied this patch, I am going to assume it has something to do with it...
Comment #30
dave reidWorked fine for me on the latest 6.x-2.x. Can you provide more details as to why it didn't work?
Comment #31
spazfoxWell, I'm not sure why it didn't work. To clarify, the patch in #26 DID work to eliminate the preg_replace() error, but now my "sometext[nid]" auto path does not work for some reason. This path DID work before I upgraded from 6.x-1.1 to 6.x-1.2.
Comment #32
spazfoxI've done a little more testing and tried reverting back to 6.x-1.1, and my "sometext[nid]" path is still not working, so I suspect it has nothing to do with this patch. I have a custom module doing some hook_nodeapi work on the content type in question, so maybe that (or a conflict with another contrib module) is the problem.
Comment #33
mchaplin commentedSubscribing
Comment #34
edg commentedI was getting same error and Pathauto's replacement patterns not working but the patch worked. Thanks!
Comment #35
rodibox commentedHi sorry if I ask something obvious but I'm not a programmer and I have trouble understanding and insert code.
I'm Using content taxonomy, taxonomy1 field defines the path of the node. [field_taxonomyl-terms]/[title-raw]
[field_taxonomy1-terms] - Names of all taxonomy terms separated by commas.-
That creates the path, separated by commas, so I'change the default separator '-' to slash '/'
I wonder if there is any way to make the taxonomy terms are separated by '/' (only change ',' by '/' in Punctuation settings and leave default separator '-' by the title , so de blank space going be separate by '-'.
thanks.
Sorry my inglis.
Comment #36
dave reidRestoring title
Comment #37
dave reidTested and committed #26 to all three branches. Also allowed us to remove the use of PREG_CLASS_ALNUM, so yay for less complexity!
http://drupal.org/cvs?commit=330230
http://drupal.org/cvs?commit=330232
http://drupal.org/cvs?commit=330236
Comment #38
psynaptic commentedAwesome timing. :)
Thanks for all the hard work guys.