Created
January 6, 2011 02:58
-
-
Save ashaw/767434 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sanitize_callback(callback) | |
if callback.nil? | |
return | |
end | |
callback=~/^(.{5}?)(\d?)/ | |
return nil if callback.length == 0 | |
return nil if $1 != "jsonp" | |
return nil if $2 == "" | |
return nil if callback.length > 128 | |
return callback | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment