Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@
mmgisglobal.role = "#{role}";
mmgisglobal.groups = "#{groups}";
mmgisglobal.NODE_ENV = "#{NODE_ENV}";
mmgisglobal.FORCE_CONFIG_PATH = "%FORCE_CONFIG_PATH%";
mmgisglobal.FORCE_CONFIG_PATH = "#{FORCE_CONFIG_PATH}";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Forced configuration paths with ampersands fail

When FORCE_CONFIG_PATH contains &, Pug inserts & into the JavaScript string. loadConfigJson fetches the altered path, so the configured mission fails to load.

Learn more

Production builds convert this HTML into a Pug template, which escapes interpolated values as HTML. Script elements do not decode HTML entities, so an escaped character becomes part of the URL passed to loadConfigJson. This affects ampersands, apostrophes, and other escaped characters in an otherwise valid forced configuration path.

Example: With FORCE_CONFIG_PATH=public/R&D/config.json, the page sets the path to public/R&D/config.json. The browser requests that encoded path rather than public/R&D/config.json, and the mission fails to load.

Recommended fix: Serialize the runtime value as a JavaScript string for the script context rather than HTML-escaping it. Account for the HTML script closing sequence when generating the string, and test paths containing & and apostrophes in a rendered production page.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

mmgisglobal.CLEARANCE_NUMBER = "#{CLEARANCE_NUMBER}";
mmgisglobal.HOSTS = "#{HOSTS}";
mmgisglobal.PORT = "#{PORT}";
Expand Down
Loading