Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed prototypejs from varien/product.js, varien/configurable.js and configurableswatches/swatches-product.js #68

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

fballiano
Copy link
Contributor

@fballiano fballiano commented Dec 12, 2024

It seems to me that everything is working correctly but since I had 1000 problems with these files I'd like for somebody else to give them a test.

EDIT: product page should work with or without prototypejs

@justinbeaty would you review this? :-)

for (const part of parts) {
if (part.includes('[')) {
const [name, index] = part.split('[');
const cleanIndex = parseInt(index.replace(']', ''));

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of ']'.

Copilot Autofix AI about 2 hours ago

To fix the problem, we need to ensure that all occurrences of the closing bracket (]) in the index string are replaced. This can be achieved by using a regular expression with the global flag (g). Specifically, we should replace index.replace(']', '') with index.replace(/\]/g, '').

Suggested changeset 1
public/js/varien/js.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/js/varien/js.js b/public/js/varien/js.js
--- a/public/js/varien/js.js
+++ b/public/js/varien/js.js
@@ -697,3 +697,3 @@
                         const [name, index] = part.split('[');
-                        const cleanIndex = parseInt(index.replace(']', ''));
+                        const cleanIndex = parseInt(index.replace(/\]/g, ''));
                         value = value[name][cleanIndex];
EOF
@@ -697,3 +697,3 @@
const [name, index] = part.split('[');
const cleanIndex = parseInt(index.replace(']', ''));
const cleanIndex = parseInt(index.replace(/\]/g, ''));
value = value[name][cleanIndex];
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@justinbeaty
Copy link
Contributor

Absolutely, I'll test first thing tomorrow.

Also nice on making a new Template class! That was the only prototypejs dependency I had left in part of the EAV code.

@fballiano
Copy link
Contributor Author

heheh good that you need that Template class :-) we can't really avoid having it :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants