Enclosure URLs usually work fine, even with spaces. But on some occasions RSS readers seem to become confused by spaces in enclosure URLs. For example, in my RSS feed I have an MP3 enclosure named "Rhymes of an Hour - Mix 1.mp3" and the upload module leaves this URL unencoded in the RSS enclosure tag's url attribute. Just using urlencode doesn't fix the issue, because it's too thorough - intended for url arguments generally. However, since spaces are the problem, only they need to be encoded. This fixes the issue where RSS readers become confused.

You can test this yourself. Make an RSS feed with an enclosure named like mine, with a few spaces, throw in a dash for good measure. Open this RSS feed in iTunes, and you should get an Error 400 - can't find the file. If, however, you modify upload_nodeapi so that it encodes space characters in the name, then clear the cache and/or run cron to get the feed to update, you will find that the enclosure now downloads properly in iTunes.

A patch for Drupal 6.20 is attached.

(The Contemplate project has the same issue because its implementation of hook_nodeapi is based on upload.module.)

Comments

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.