Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Duplicate URL for image with... with :class in :url #660

Closed
kenips opened this issue Dec 2, 2011 · 6 comments
Closed

Duplicate URL for image with... with :class in :url #660

kenips opened this issue Dec 2, 2011 · 6 comments
Labels

Comments

@kenips
Copy link

kenips commented Dec 2, 2011

Hi, just wondering if paperclip is simply reading the path and reporting them as identical? Perhaps it should check that if :class is included in path then a clash won't happen? Thanks.

[paperclip] Duplicate URL for image with /system/:class/:attachment/:id/:basename-:style.:extension. This will clash with attachment defined in Your class
[paperclip] Duplicate URL for image with /system/:class/:attachment/:id/:basename-:style.:extension. This will clash with attachment defined in My class
@uberllama
Copy link

Think something got missed. I'm seeing this with 3.0 (upgrading from 2.4.1). No idea what's causing it:

[paperclip] Duplicate URL for image with :s3_domain_url. This will clash with attachment defined in Avatar class
[paperclip] Duplicate URL for image with :s3_domain_url. This will clash with attachment defined in Group class

I have the following in an initializer:

Paperclip::Attachment.default_options.merge!(
  :url => ':s3_domain_url',
  :path => ':class/:attachment/:id/:style/:filename'
)

...so that multiple classes with attachments use the same path format without having to specify the same format in their has_attached_file declarations.

@mhuggins
Copy link

I'm seeing this too for classes that have two completely different strings. Here's my (condensed) setup:

class Advertisement::ImageBanner < ActiveRecord::Base
  has_attached_file :image,
    :path => 'advertisements/image_banner/:id_partition/:style/:basename.:extension'
end

class Advertisement::TextBanner < ActiveRecord::Base
  has_attached_file :image,
    :path => 'advertisements/text_banner/:id_partition/:style/:basename.:extension'
end

And the warning messages I'm seeing:

[paperclip] Duplicate URL for image with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in Advertisement::ImageBanner class
[paperclip] Duplicate URL for image with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in Advertisement::TextBanner class

@phene
Copy link
Contributor

phene commented Apr 4, 2012

I get something similar:

Paperclip::Attachment.default_options[:path] = "tenants/:tenant_id/:class/:id/:file_name_with_style"
Paperclip::Attachment.default_options[:url] = ":s3_path_url"
[paperclip] Duplicate URL for data with :s3_path_url. This will clash with attachment defined in ProfilePhoto class

@tusharc
Copy link

tusharc commented Jun 2, 2012

+1

@brian5150
Copy link

Has this been resolved? Thanks.

@bamorim
Copy link

bamorim commented Aug 22, 2012

Same problema here, has this been solved?

Thank you.

urbanautomaton pushed a commit to urbanautomaton/paperclip that referenced this issue Sep 19, 2012
As per discussion in issue thoughtbot#660, attachments using alias interpolations
for the attachment URL mistakenly get flagged as being duplicates,
although the interpolation expands to a unique location.

This commit (partially) addresses the issue by checking the attachment path
instead. However, the problem will remain for users who use
interpolations other than :class to distinguish attachment paths for
different models.
jyurek pushed a commit that referenced this issue Nov 2, 2012
As per discussion in issue #660, attachments using alias interpolations
for the attachment URL mistakenly get flagged as being duplicates,
although the interpolation expands to a unique location.

This commit (partially) addresses the issue by checking the attachment path
instead. However, the problem will remain for users who use
interpolations other than :class to distinguish attachment paths for
different models.
robg pushed a commit to robg/paperclip that referenced this issue Jan 4, 2013
As per discussion in issue thoughtbot#660, attachments using alias interpolations
for the attachment URL mistakenly get flagged as being duplicates,
although the interpolation expands to a unique location.

This commit (partially) addresses the issue by checking the attachment path
instead. However, the problem will remain for users who use
interpolations other than :class to distinguish attachment paths for
different models.
jyurek pushed a commit that referenced this issue Feb 8, 2013
As per discussion in issue #660, attachments using alias interpolations
for the attachment URL mistakenly get flagged as being duplicates,
although the interpolation expands to a unique location.

This commit (partially) addresses the issue by checking the attachment path
instead. However, the problem will remain for users who use
interpolations other than :class to distinguish attachment paths for
different models.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants