diff --git modules/path/path.module modules/path/path.module index 5c66e06..668d6b0 100644 --- modules/path/path.module +++ modules/path/path.module @@ -104,10 +104,12 @@ function path_set_alias($path = NULL, $alias = NULL, $pid = NULL, $language = '' // Check for existing aliases. if ($alias == drupal_get_path_alias($path, $language)) { // There is already such an alias, neutral or in this language. - // Update the alias based on alias; setting the language if not yet done. - db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE dst = '%s'", $path, $alias, $language, $alias); + db_query("UPDATE {url_alias} SET src = '%s' WHERE dst = '%s' AND language = '%s'", $path, $alias, $language); } else { + // We need to delete any previous occurence of this alias for the same language since previous test + // is done for an alias on this nid and might find an alias set for another language + db_query("DELETE FROM {url_alias} WHERE dst = '%s' AND language = '%s'", $alias, $language); // A new alias. Add it to the database. db_query("INSERT INTO {url_alias} (src, dst, language) VALUES ('%s', '%s', '%s')", $path, $alias, $language); }