Metadata oddity: duplicate keys in data #658
Unanswered
walterdavis
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using a script to "fix" the filename metadata for some images my client uploaded. Despite repeated warnings, they put punctuation and white space in the actual file names.
The name of the file is part of the URL, and important to me and various web crawlers for SEO reasons. I also needed to have predictable filenames in storage on S3 so I could align them with CloudFront and still serve my desired URLs.
While running this latest script, I noticed the JSON [attacher]_data column had this value:
Note the doubling of the filename key, once null, and a second time with a value. Now because the last value "wins", this doesn't break anything else in my app. But it is odd. And I'm not sure where to go looking for my error (which I assume is why this is happening at all, not Shrine itself).
Main Shrine config:
This is perhaps fighting with the metadata_attributes plugin invoked here:
Interestingly, the
file_name
attribute in the database (being set by themetadata_attributes
plugin configuration here) is also null after this runs. So that tells me that the first instance of thefilename
key is probably still nil when the plugin comes through to make its column assignment, and is only getting set afterwards, as the duplicate key. (This is what led me to stash the original filename in the now-unused file_uid column left over from when this app used Paperclip or CarrierWave or something.)Questions:
generate_location
,metadata_attributes
, andactive_record
plugins?Thanks in advance for any suggestions, follow-up questions, or general advice you can offer!
Walter
Beta Was this translation helpful? Give feedback.
All reactions