Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-uploading of image attachment with variants - variants have incorrect extension #67

Open
nevedimko opened this issue Aug 27, 2021 · 0 comments

Comments

@nevedimko
Copy link

nevedimko commented Aug 27, 2021

I added variants to my model's paperclip config and encountered a problem when re-uploading images. Original was uploaded as expected, but variants were uploaded with incorrect extension (from previous version).

Example: Firstly I uploaded image image.png and everything was good. Original and variants were uploaded and saved.
Later I decided to replace image to image.jpg and original was uploaded correctly, but variants had incorrect extension png from previous version.
I guess problem in methods variantFilename() of AttachmentData and Attachment classes. They return different results after interpolation. AttachmentData class returns path based on previous version of attachment, even in case of re-uploading.

Config:

        $this->hasAttachedFile('logo', [
            'storage' => 's3',
            'variants' => [
                Variant::make('thumb')->steps([
                    ResizeStep::make()->square(100)
                ]),
                Variant::make('small')->steps([
                    ResizeStep::make()->square(300)
                ]),
            ],
            'attributes' => [
                'variants' => true,
                'file_size' => false,
                'content_type' => false
            ]
        ]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant