Heh, yes, I'm back to my favorite tag to pick on. A user sent in an interesting problem he was having with cffeed. When he used a value for the source that came from a query, he got an error. When he hard coded a URL in, it worked just fine. I looked over his code and as far as I could see, everything seemed fine. The error itself was pretty weird as well:
Unable to read the feed source file /Users/ray/Documents/Web Sites/webroot/http:/rss.news.yahoo.com/rss/mideast
As you can see, the feed url (http://rss.news.yahoo.com/rss/mideast) was somehow being munged into a local path. I added a debug statement to the output and then I noticed it. A slight space between my debug line and the actual value. Turned out the data from the query had an extra white space in front of the URL. You can reproduce this problem yourself with the following code:
<cfset theURL = " http://rss.news.yahoo.com/rss/mideast">
<cffeed action="read" source="#theURL#" properties="meta" query="items">
<cfdump var="#items#">
Most likely the data was based on user input and he forgot to trim before entering the data into the database. It was easy enough to fix of course:
<cfset theURL = " http://rss.news.yahoo.com/rss/mideast">
<cffeed action="read" source="#trim(theURL)#" properties="meta" query="items">
<cfdump var="#items#">
Archived Comments
and exactly how is this CFEED's problem? seems to me that if he forgets to sanitize his input, it's his fault.
http://xkcd.com/327/
True - but one could argue that CFFEED makes an odd decision on switching to file based lookups because of the space.
why is it strange? filenames can have spaces in them, urls cannot per rfc 1738.
True. I'm guessing their back end code does: if url, fetch, else load from file system, and the if url fails on the space. Of course, it works just fine if you add a space at the end. That's what threw me at first.
Either way - this post really wasn't meant to assign blame per se, but to serve as a warning, as it certainly wasn't obvious what was going on.