Skip to content

Commit 885842b

Browse files
committed
Fix Generic Object Injection Sink
1 parent 69f0dbb commit 885842b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

utils/functions/functions.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ export const getFormattedCart = (data) => {
6363
const givenProduct = givenProducts[parseInt(i,10)].product;
6464
const product = {};
6565
// Convert price to a float value
66-
const convertedCurrency = givenProducts[i].total.replace(/[^0-9.-]+/g, '');
66+
const convertedCurrency = givenProducts[parseInt(i,10)].total.replace(/[^0-9.-]+/g, '');
6767

6868
product.productId = givenProduct.productId;
69-
product.cartKey = givenProducts[i].key;
69+
product.cartKey = givenProducts[parseInt(i,10)].key;
7070
product.name = givenProduct.name;
71-
product.qty = givenProducts[i].quantity;
71+
product.qty = givenProducts[parseInt(i,10)].quantity;
7272
product.price = convertedCurrency / product.qty;
73-
product.totalPrice = givenProducts[i].total;
73+
product.totalPrice = givenProducts[parseInt(i,10)].total;
7474
// Ensure we can add products without images to the cart
7575
givenProduct.image
7676
? (product.image = {
@@ -84,7 +84,7 @@ export const getFormattedCart = (data) => {
8484
title: givenProduct.name,
8585
});
8686

87-
totalProductsCount += givenProducts[i].quantity;
87+
totalProductsCount += givenProducts[parseInt(i,10)].quantity;
8888
// Push each item into the products array.
8989
formattedCart.products.push(product);
9090
i++;

0 commit comments

Comments
 (0)