If the node title contains only the ignore words (possible in dictionary/vocabulary sites) and the output results to a blank alias. The attached patch is the fix for this issue. Also at line 219 of pathauto.inc the $maxlength is hard coded to "128", I changed to return value of _pathauto_get_schema_alias_maxlength() which now I believe 255 in Drupal 7.

CommentFileSizeAuthor
#1 pathauto.inc_.patch1.54 KBarpeggio

Comments

arpeggio’s picture

Category: task » bug
StatusFileSize
new1.54 KB

Sorry I forgot the attachment.

arpeggio’s picture

Title: If node title contains only ignore words, it results to a blank alias » The maximum alias length still enforced to 128 in per component basis
Assigned: arpeggio » Unassigned
Status: Closed (duplicate) » Active

In line 214 of pathauto.inc is hard coded with 128 maximum length (per component) it prevents the alias to reach the length specified in {url_alias} table (alias field) which is now set to 255 in drupal 7. For example in admin/config/search/path/pathauto if the user set his Default path pattern (applies to all node types with blank patterns below) field to [node:title] only, all nodes' alias will still have the maximum length of 128 because the line 214 of pathauto.inc enforced it:
$maxlength = min(variable_get('pathauto_max_component_length', 100), 128);
In the patch of previous post contains:

-  $maxlength = min(variable_get('pathauto_max_component_length', 100), 128);
+  $maxlength = min(variable_get('pathauto_max_component_length', 100), _pathauto_get_schema_alias_maxlength());

Also the patch includes the fix for #631460: Paths can end up as empty strings, but Pathauto should insert a number (or something) instead which the patch code does is to left the alias untounched to avoid blank alias if component contains only the ignore words:

-  if (function_exists('mb_eregi_replace')) {
-    $output = mb_eregi_replace($ignore_re, '', $output);
+	// If element contains only the ignore words, left the alias untounched to avoid blank alias
+  if (function_exists('mb_eregi_replace')) {	
+		$temp_output = trim(mb_eregi_replace($ignore_re, '', $output));
   }
   else {
-    $output = preg_replace("/$ignore_re/i", '', $output);
+		$temp_output = trim(preg_replace("/$ignore_re/i", '', $output));
   }
+	$words = preg_replace('/ |' . $separator . '/', '', $temp_output);
+	if (strlen($words)) {
+		$output = $temp_output;	
+	}	
dave reid’s picture

dave reid’s picture

Title: The maximum alias length still enforced to 128 in per component basis » If node title contains only ignore words, it results to a blank alias
Status: Active » Closed (duplicate)

Restoring the major meta-data.