lib/scribd_fu.rb in scribd_fu-2.0.7 vs lib/scribd_fu.rb in scribd_fu-2.0.8
- old
+ new
@@ -101,9 +101,21 @@
# Replace spaces with '%20' (needed by Paperclip models).
def escape(str)
str.gsub(' ', '%20')
end
+ # See if a URL is S3 or CloudFront based
+ def amazon_based?(url)
+ url =~ S3 || url =~ CLOUD_FRONT
+ end
+
+ # Strip off any trailing "?1234567890" cache strings
+ # They cause headaches on Scribd's end.
+ def strip_cache_string(url)
+ pos = url.rindex('?')
+ (pos) ? url[0, pos] : url
+ end
+
end
module ClassMethods
# Load and inject ScribdFu goodies