-
Notifications
You must be signed in to change notification settings - Fork 139
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
allow to provide a filename for assets created from URL #1336
Conversation
@i-just interesting - I suppose this is a good solution if you have control over the formatting of the feed. What about the case where it’s a 3rd party feed (which is what sounds like the original issue is), and you only have this?
I’m guessing this PR doesn’t address that (but correct me if I’m wrong). If that’s the case, I’m guessing we recommend using an event (like Because the full URIs for an asset in a feed should be unique, and if we wanted to make this automagical, maybe we create a hash out of the URI for the imported filename? |
You are 100% correct. I forgot about the case where you can’t control the feed. Let me give it a bit more thought! |
Do you mean You’d have to go through the field mapping, get the desired/all Assets fields; then hook up “fake” filenameNode mapping, then go through the feed data and for items that match the desired/all Assets fields, add the feed data that matches the “fake” mapping; when matching the mapped Assets field node to the data feed items, you’d have to remember that the node might match exactly, or the value could have been an array, that it can be delimited etc. Something along those lines could work for JSON:
I looked at what we have available, and couldn’t find an event that would make this easier, so I opted for adding a new one, just for the Assets field for specifying filenames. It’s one of two relation fields where you can’t choose what to use to match with existing data, so I think it makes sense (the other one is the Tags field, a match is done based on the title there). It drastically simplifies the developer’s effort (compared to the above snippet) and allows you to choose how you want to name the files; You can go with md5, with what OP originally suggested etc. So, if you can control the feed - you can provide and map the filenames. If you can’t, you can do it via the new event.
LMK your thoughts when you have a sec. |
Yup, I think this is great - covers both bases and is much cleaner than what I suggested. |
This looks like a great solution, is there an ETA? This issue happens when importing YouTube thumbnails from their official RSS feeds, e.g. |
Is there any chance this can be reviewed and merged in? The bug this PR addresses is causing a major headache for us trying to migrate a publisher with 20k+ posts coming from WordPress, and a massive chunk of them are not getting the correct image files imported. Too many to manually fix! |
# Conflicts: # src/web/assets/feedme/dist/FeedMe.js # src/web/assets/feedme/dist/FeedMe.js.map
…ets via the assets field if you choose to “Create asset from URL”.
Description
Adds the ability to provide a filename for importing assets via the assets field if you choose to "Create asset from URL".
New
options.filenameNode
dropdown field is added below the conflict selection, where user can map the filename they want to use (see bottom of the screenshot).The mapped filename will be used when uploading images via absolute URL to check if the file already exists. If the filename is not provided via
options.filenameNode
mapping, then one will be parsed from the URL, as it’s been happening so far.The conflict resolution method is respected in the same way regardless of whether the separate filename is provided or not.
Example feed:
Related issues
#749