Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/easy-comics-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"strapi-plugin-webtools": patch
---

Fix incorrect duplication prevention for content types without internationalization
20 changes: 9 additions & 11 deletions packages/core/server/middlewares/prevent-duplicate-urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ const preventDuplicateUrlsMiddleware: Modules.Documents.Middleware.Middleware =
const params = context.params as Modules.Documents.ServiceParams<'plugin::webtools.url-alias'>['create' | 'update' | 'clone'] & { documentId: string };

if (params.data.url_path) {
params.data.url_path = await getPluginService('url-alias').makeUniquePath(
params.data.url_path,
action !== 'clone' && [
{
documentId: params.documentId,
},
{
locale: params.locale,
},
],
);
const excludeFilters: { [key: string]: any }[] = [];

excludeFilters.push({ documentId: params.documentId });

if (params.locale) {
excludeFilters.push({ locale: params.locale });
}

params.data.url_path = await getPluginService('url-alias').makeUniquePath(params.data.url_path, action !== 'clone' && excludeFilters);
}

return next();
Expand Down