Duplicate declaration in metadata files[].cdnFIles when using modules and some files share the same name

Hey, I’m evaluating Localazy for our company and ran into a blocker:

As we have several apps and some of our files share the same name between our apps, I used the module feature when uploading our keys. Worked great.

But when downloading the metadata file, if two or more files share the same name despite being in different modules, they’re merged in a single entry within the files[] array, but the cdnFiles object contains a duplicate declaration as there are two files for the same language…

    {
      cdnHash: "xxxxxxx",
      file: "select.js",
      path: "frontend/ugc",
      library: "",
      module: "ugc",
      buildType: "",
      productFlavors: [],
      cdnFiles: {
        "fr": "https://delivery.localazy.com/xxx/_e0/aaa/fr/select.js",
        "fr": "https://delivery.localazy.com/xxx/_e0/bbb/fr/select.js"
      }
    },

Would be best to have two separate entries if files are in different modules :slight_smile:

Hello Edgar,

thanks for reaching out! I’ve looked at your project and the files in question, select.js are now separate since their file paths differ. Have you modified it since you posted this?

I have limited experience with modules myself, so I take your word for it that it works this way. And it makes sense since the main differentiator of files is the combination of file name and path. A module is more like a tag, rather than a unique file differentiator.

However, I believe it’s still possible to look up the specific file, for example the ugc module, even with this structure? I agree that having those as separate entries would be better, but that would be a big breaking change not just with regards to CDN, but to the file management overall.

I would advise you to either differentiate the files with the same name through paths, or stick to modules, but adjust your service logic to look into the cdnFiles attribute to look up the specific module. Hope this helps :slightly_smiling_face:

Thanks for your reply @dan,

I’ve added path values to differentiate the files yes, but the result is the same in the metadata files (.ts, .js include duplicate declarations in cdnFiles attribute, .json extension skips the duplicate).

I don’t see any way to differentiate and identify them from the metadata file as one of the file is overwriting the other, so I don’t have access to the module nor path attributes. I guess I could add some logic using the cdnFile uuid that looks unique to the file, but I wouldn’t need your metadata feature then, and still miss the module/path this file belongs to :slight_smile:

I understand that would be a big change if I stick with module differentiation only. But as I provided unique path/name combinations for my files, I should get two separate entries for those files in the metadata payload. Here’s what I expect in my metadata.js file (instead of what I’m receiving, as you can see in my first post):

    {
      cdnHash: "xxxxxxxxx",
      file: "select.js",
      path: "frontend/ugc",
      library: "",
      module: "ugc",
      buildType: "",
      productFlavors: [],
      cdnFiles: {
        "fr": "https://delivery.localazy.com/xxx/_e0/aaa/fr/select.js",
      }
    },
    {
      cdnHash: "zzzzzzzzzzzz",
      file: "select.js",
      path: "frontend/app",
      library: "",
      module: "app",
      buildType: "",
      productFlavors: [],
      cdnFiles: {
        "fr": "https://delivery.localazy.com/xxx/_e0/bbb/fr/select.js",
      }
    },

I understand. I will discuss this with my colleagues and see what options we have :slightly_smiling_face:

Hello, @Edgar_Roussille; thanks for reporting it.

I will have a look at it. Of course, we need to evaluate if and how the change would affect existing users.

I added it to my list, and in case of any questions or solutions, I will let you know here.