# File lib/dragonfly/serializer.rb, line 19 def b64_decode(string) padding_length = (-(string.length % 4)) % 4 string = string.tr('+','-').tr('~/','_') Base64.urlsafe_decode64(string + '=' * padding_length) rescue ArgumentError => e raise BadString, "couldn't b64_decode string - got #{e}" end