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 + '%'],