Added more correct regexp (#76)

This commit is contained in:
Arwid Thornström
2021-10-22 09:03:08 +02:00
committed by GitHub
parent e821e41500
commit 8d9477d85b
+1 -1
View File
@@ -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 + '%'],