Download & Extend

Handling language prefix in target url.

Project:Pingback
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

Hi,

the pingback module doesn't seems to work when you have a multi language site with language negotiation activated via url prefixes.

Let me give an example: fom the TestTrack site I send a pingback request linking http://www.example.com/en/blog/2009/06/26/test-pingback, well, the url alias to be translated will be en/blog/2009/06/26/test-pingback which is not handled correctly in the drupal_get_normal_path() call in _pingback_extract_urls(), so the node id cannot be extracted and the pingback request fails.

I don't know if this is a drupal bug, but I got around it with the attached changes. Please let me know if there is a better way to handle this case.

Thanks,
Antonio

AttachmentSize
pingback_alias_strip_language_prefix.patch1.01 KB

Comments

#1

I'm also being bitten by this bug (which I've misreported as #738446: drupal_get_normal_path() not working). It would be nice if Andreas had a look at your patch, it looks quite nice indeed. Thanks.

#2

The patch will fail for sites that do not use language prefixes, but have a path that matches an installed language. There must be a way to check if language prefixing is being used on the site and wrap the code in that?

#3

The patch doesn't pass the path_language, thus it seems not to be able to unalias paths not in the default language. This second version fixes that by keeping the matched language and passing it to drupal_get_normal_path(). However, it doesn't work with paths in English (which is not my site default). Also, it doesn't avoid the problem spotted by Andreas.

(I'm starting to think that me starting to use URL aliases was a very bad idea...)

AttachmentSize
pingback_alias_strip_language_prefix,v2.patch 1.23 KB

#4

I´ve added an attachment with the function code for _pingback_url_to_nid() I´m using. It includes some checks concerning multi language installations.

AttachmentSize
pingback.module.txt 1.5 KB
nobody click here