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

after_post_process callback called on invalid object #1698

Closed
allenwalker3 opened this issue Nov 14, 2014 · 7 comments
Closed

after_post_process callback called on invalid object #1698

allenwalker3 opened this issue Nov 14, 2014 · 7 comments

Comments

@allenwalker3
Copy link

I'm creating a attachment , inside the model I call

@asset = Asset.new(
  :attachable_id => params[:attachable_id],
  :attachable_type => params[:attachable_type],
  :data => params[:file_upload]
)

When I upload a file that's a content spoof, I get:

[paperclip] Content Type Spoof: Filename libtool.gif (["image/gif"]), content type discovered from file command: text/x-shellscript. See documentation to allow this combination.

but my after_post_process method is still called. When I debugged inside the after_post_process method, self.valid? was false for the content spoofed and was valid for the legitimate attachment.

It should have never called the after_post_process when self.valid? == false according to the documents.

Thanks

@nhinze
Copy link

nhinze commented Jul 28, 2015

Has this been resolved? I'm having the same issue with PaperClip 4.3. I posted this StackOverflow question yesterday:

http://stackoverflow.com/questions/31665588/paperclip-is-not-executing-validates-attachment

@tute
Copy link
Contributor

tute commented Sep 9, 2015

@jyurek do we want to update the documentation to describe this behavior, or change the behavior to what the docs say?

@allenwalker3
Copy link
Author

I think the code should reflect what the documentation says. So it's a bug to me.

@tute
Copy link
Contributor

tute commented Mar 24, 2016

What version of Rails are you using? Is this still an issue? We've been editing related code, and need reproduction steps.

@allenwalker3
Copy link
Author

At the time, 3.2.16, since moved the 4.2.4 but left the code as is.

@tute
Copy link
Contributor

tute commented May 9, 2016

Related with: #2178

@tute
Copy link
Contributor

tute commented May 9, 2016

Closing in favor of related issue, which has more information. Thank you for reporting.

@tute tute closed this as completed May 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants