Skip to content

Conversation

@keithcurtis1
Copy link
Contributor

Director, new script to run Theater of the Mind style games
Jukebox Plus update: Added Min/Max intervals to Mix mode, bug and display fixes, and simple Director integration

Copy link

@aikepah aikepah left a comment

Choose a reason for hiding this comment

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

There's some unused code, but seems fine in general. Found one issue with unescaped double quotes when put in your template literals that prevents users from being able to add handouts or characters when there's a double quote in the name.

const tracks = findObjs({ _type: 'jukeboxtrack' }).sort((a, b) => a.get('title').localeCompare(b.get('title')));

const buildOpts = (objs, labelFn = o => o.get('name')) =>
objs.map(o => `${labelFn(o)},${o.id}`).join('|');
Copy link

Choose a reason for hiding this comment

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

If the object's name contains a double quote, ie: Thomas "Tommy" Boy it will cause the button's href to terminate early. If we escape or replace the " with " here in buildOpts it should avoid this issue.

Suggested change
objs.map(o => `${labelFn(o)},${o.id}`).join('|');
objs.map(o => `${labelFn(o).replace(/"/g, """)},${o.id}`).join('|');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I'll make those changes. I wasn't too concerned about breaking characters in names, because those even break vanilla macros half the time. I usually suggest to people not to include "control characters" in character and token names for that reason:
"':/(){}[], etc.

And, yeah, there was a lot of iteration on this, and it could use a cleanup sweep for abandoned code. Good catch.

@Alicekb Alicekb merged commit 70597e3 into Roll20:master Jul 22, 2025
1 check passed
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.

3 participants