Redirection not working (fix)
| Project: | FeedBurner |
| Version: | 5.x-0.5 |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Dave Reid |
| Status: | closed |
Jump to:
First thanks for this module.
I've noticed that the redirection was not working as expected on my install.
Looking a bit more in the code I found that the point of failure was in the function : _feedburner_do_redirect() [line 539]
-
Problem #1 : regexp invalid, line 542
$useragents = '/'. variable_get('feedburner_useragents', FEEDBURNER_DEFAULT_USERAGENTS) .'/i';
it returns : '/|feedburner|feedvalidator/i' instead of '/feedburner|feedvalidator/i'
so I added
$useragents = str_replace('/|','/',$useragents); -
Problem #2 : drupal aliases not checked, line 548
In my setup the original feed has been aliased into a readable url. To make it work I've replaced the original line :
$path = $_GET['q'];
by
$path = isset($feeds[$_GET['q']]) ? $_GET['q'] : (isset($feeds[drupal_get_path_alias($_GET['q'])])?drupal_get_path_alias($_GET['q']):null);
Regards,
Marc Carlucci

#1
Thanks also for the bug report. I'll take a look at both of these problems.
I did a little testing on the first one, and I made a new regex pattern in the function feedburner_admin_settings_validate that still replaces any blank lines with '|' but also removes any if they are at the beginning or end of the string, preventing the problem you described.
$useragents = preg_replace('/[\\r\\n]+/', '|', $useragents); // replace blank lines with pipe to format for a regular expression$useragents = preg_replace('/\\A\\|+|\\|+\\z/', '', $useragents); // remove beginning and ending pipes if present
You may be on to something with the second problem. I'll look into it as well.
#2
I'm bumping this from critical priority and marking as fixed. I should be able to upload this to CVS and create a new release very soon.
#3
Ok these should be fixed in the very upcoming development release (5.x-1.x). Let me know if you have any more bugs that may come up!