Pennebaker / craft-architect

A plugin for importing and exporting content models from Craft 3/4 using JSON.
MIT License
72 stars 6 forks source link

Error importing asset field with all sources #23

Closed jeffreyschmitz87 closed 6 years ago

jeffreyschmitz87 commented 6 years ago

When you create an export of an asset field (which has All checked in the sources settings of the field) and try to import the field it gives you an error: There was an error mapping the source handles to existing sources.

This code fails

{
    "fieldGroups": [
        "Common"
    ],
    "fields": [
        {
            "group": "Common",
            "name": "Image",
            "handle": "image",
            "instructions": "",
            "type": "craft\\fields\\Assets",
            "useSingleFolder": "",
            "defaultUploadLocationSource": "uploads",
            "defaultUploadLocationSubpath": "",
            "singleUploadLocationSource": "uploads",
            "singleUploadLocationSubpath": "",
            "restrictFiles": "1",
            "allowedKinds": [
                "image"
            ],
            "sources": "*",
            "viewMode": "list",
            "limit": "1",
            "selectionLabel": "",
            "localizeRelations": ""
        }
    ]
}

When you change the sources setting to only one source, export the field again and import the field it works. This code works

{
    "fieldGroups": [
        "Common"
    ],
    "fields": [
        {
            "group": "Common",
            "name": "Image",
            "handle": "image",
            "instructions": "",
            "type": "craft\\fields\\Assets",
            "useSingleFolder": "",
            "defaultUploadLocationSource": "uploads",
            "defaultUploadLocationSubpath": "",
            "singleUploadLocationSource": "uploads",
            "singleUploadLocationSubpath": "",
            "restrictFiles": "1",
            "allowedKinds": [
                "image"
            ],
            "sources": [
                "uploads"
            ],
            "viewMode": "list",
            "limit": "1",
            "selectionLabel": "",
            "localizeRelations": ""
        }
    ]
}
spAnser commented 6 years ago

I was able to import both properly on my end. Are you on the latest version of Architect?

Scratch that I didn't update my second dev environment to latest version properly.