File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,10 +54,14 @@ def filename(attachment, style_name)
5454 # Returns the interpolated URL. Will raise an error if the url itself
5555 # contains ":url" to prevent infinite recursion. This interpolation
5656 # is used in the default :path to ease default specifications.
57- RIGHT_HERE = "#{ __FILE__ . gsub ( %r{\A \. /} , '' ) } :#{ __LINE__ + 3 } "
5857 def url ( attachment , style_name )
59- raise Errors ::InfiniteInterpolationError if caller . any? { |b | b . index ( RIGHT_HERE ) }
58+ if Thread . current . thread_variable_get ( :kt_paperclip_no_recursion )
59+ raise Errors ::InfiniteInterpolationError
60+ end
61+ Thread . current . thread_variable_set ( :kt_paperclip_no_recursion , true )
6062 attachment . url ( style_name , timestamp : false , escape : false )
63+ ensure
64+ Thread . current . thread_variable_set ( :kt_paperclip_no_recursion , false )
6165 end
6266
6367 # Returns the timestamp as defined by the <attachment>_updated_at field
You can’t perform that action at this time.
0 commit comments