[Facebooker-talk] Sanitizing the New Session Key Format

David Crockett idavidcrockett at gmail.com
Tue Nov 25 03:32:53 EST 2008


Facebook's new session format contains periods and underscores which  
appear to be breaking mem_cache_store.  To get my app working again, I  
appended the following code to the end of environment.rb

class CGI
class Session
   class MemCacheStore
     def check_id(id) #:nodoc:#
	id = id.gsub('-', '').gsub('.', '').gsub('_', '')
       /[^0-9a-zA-Z-]+/ =~ id.to_s ? false : true
     end
   end
end
end

The above code tricks rails into thinking the session key only  
contains alphanumeric characters.  How will the non-alphanumeric  
characters affect rails?  Does anyone have a better solution for this  
problem?

- David Crockett




More information about the Facebooker-talk mailing list