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

UID stored in image_meta_data may not reflect stored image #8

Closed
johnlane opened this issue Feb 20, 2016 · 3 comments
Closed

UID stored in image_meta_data may not reflect stored image #8

johnlane opened this issue Feb 20, 2016 · 3 comments

Comments

@johnlane
Copy link

The URL returned by Paperdragon is not the URL to the image in cases where the original filename is not unique.

Paperdragon appends characters to a non-unique filename to make it unique but it does not reflect this in the uid stored in image_meta_data: all images that have the same original filename have the same uid.

When an image is retrieved, its URL can be obtained as per the documentation:

image[:thumb].url

Because the stored uid reflects the wrong file, the returned URL is wrong.

I have created a test application to demonstrate this issue.

@johnlane
Copy link
Author

I've just looked at the code.

The file is disambiguated when Dragonfly stores it (lib/dragonfly/file_data_store.rb#disambiguate). It inserts a five character string before the file extension that it derives from the current time and some randomness.

The disambiguated filename is returned by job.store (paperdragon/file/operations.rb#upload!), so it can be tested for difference and propagated if necessary. I have submitted a PR to do this.

@apotonick
Copy link
Owner

Is that closed by #9 ?

@johnlane
Copy link
Author

johnlane commented Mar 2, 2016

Yes that PR was to resolve this issue :)

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

2 participants