0

I'm trying to import json data from a legacy system into new entries and there are files associated with them.

I've put all the files in the assets dir and run "Update assets index" so they show in Craft in the right asset volume. The files are all grouped into many subdirs. They have to be in subdirs because there are a lot of files with the same name.

7932385b-533e-477c-96fd-a2f4fc30aba3/file with spaces.pdf
7932385b-533e-477c-96fd-a2f4fc30aba3/another-file.png
a46684dd-b121-46ca-9512-4b10af4120cf/another-file.png
<many more...>

My json looks like this:

[
  {
    "FirstName": "John",
    "LastName": "Smith",
    "documents": [
      {
        "filename": "7932385b-533e-477c-96fd-a2f4fc30aba3/file with spaces.pdf"
      },
      {
        "filename": "7932385b-533e-477c-96fd-a2f4fc30aba3/another-file.png"
      }
    ]
  },
  {
    "FirstName": "June",
    "LastName": "Black",
    "documents": [
      {
        "filename": "a46684dd-b121-46ca-9512-4b10af4120cf/another-file.png"
      }
    ]
  }
]

The problem is that when this is imported, FeedMe is looking for the slugified versions of the filename, eg. file-with-spaces.pdf not the one that actually exists in the filesystem. If I rename the file to match this it works.

I would just do a mass file rename and replace spaces with dashes but the slugify algorithim that is being used seems to be doing other things to fix up the name.

Is there a way to make FeedMe look for the real filename or is there a way to get Craft to slugify the files when I do a 'Update assets index'?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.