Skip to content
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

LocalizationService.ImportResourcesFromXml() allows inserting duplicate resources #4617

Closed
alinmircea opened this issue Apr 27, 2020 · 0 comments
Assignees
Labels
Milestone

Comments

@alinmircea
Copy link

nopCommerce version: 4.30 and probably lower

Steps to reproduce the problem:

  1. Use LocalizationService.ImportResourcesFromXml() to import duplicate resources.

  2. Afterwards try to query the LocaleStringResource repository and cas toDictionary as ImportResourcesFromXml is doing :

var lsNamesList = _lsrRepository.Table.Where(lsr => lsr.LanguageId == language.Id).ToDictionary(lsr => lsr.ResourceName, lsr => lsr);

Error will be received on the ToDictionary cast: "An item with the same key has already been added. Key: Admin.Configuration.Languages.Fields.FlagImage"

ImportResourcesFromXml should not allow duplicate inserts based on resource key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants