From 8d9477d85beb3c4bf9d94a161cbf935f0412a554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arwid=20Thornstr=C3=B6m?= Date: Fri, 22 Oct 2021 09:03:08 +0200 Subject: [PATCH] Added more correct regexp (#76) --- src/datasources/product-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datasources/product-api.ts b/src/datasources/product-api.ts index ae1df15..c114bcf 100644 --- a/src/datasources/product-api.ts +++ b/src/datasources/product-api.ts @@ -303,7 +303,7 @@ export class ProductAPI extends BaseSQLDataSource { // Check for unique-path // Get paths from product-products - const basePath = slug(path, { remove: /(\d+)(?!.*\d)/ }); // Remove last number adf-1-asdf-123 = adf-1-asdf- + const basePath = slug(path, { remove: /(\d+)(?!.*\d)$/g }); // Remove last number adf-1-asdf-123 = adf-1-asdf- const pathResponse = await this.knex.raw( `SELECT path FROM "product-products" WHERE path LIKE ?`, [basePath + '%'],