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

fix:issue on do not validate locale if not creating for all locales #19799

Merged
10 changes: 10 additions & 0 deletions packages/plugins/i18n/server/src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,22 @@ const isUrlForCreation = (url: string) => {
// [ 'content-manager', 'collection-types', 'api::category.category' ]
const splitUrl = url.split('/').filter(Boolean);

// Checking for query params and removed in the
const regex: RegExp = /[?]\S/;
const indexQueryParam = splitUrl.findIndex(item=>regex.test(item));

if (indexQueryParam !== -1) {
splitUrl.splice(indexQueryParam, 1);
}

// Get the last element of the array
// api::category.category / 1 / publish

const model = splitUrl[splitUrl.length - 1];

// If the model contains :: it means it's a uid
return model.includes('::');

};

/**
Expand Down