Repair the page a bad patch doubled, and fix the price properly

My previous patch put a dollar sign next to a quote in the REPLACEMENT text.
That is a substitution token, so the whole rest of the file was spliced in and
script.html went from 82KB to 148KB with render() cut in half. Writing it as a
$ escape did not avoid it either - that is decoded before the substitution
runs and springs exactly the same trap.

- The broken line is restored, with the currency sign as the HTML entity $
  which contains no dollar character at all.
- The spliced duplicate is commented out to end of file. The live copy is the
  one above it, so every future anchor still matches the live code first.
- Price now comes from the fresh quote get_project returns rather than the
  price_usd stamped on the row at creation, which ignored the markup change.

Patch order matters here: the corrected line itself contains the fragment text,
so the fragment is dealt with first.
This commit is contained in:
gator 2026-09-15 02:26:12 +00:00
parent 2467b779b0
commit dc336db708

View file

@ -282,7 +282,13 @@ function render(r) {
// Built from a code point so no dollar sign sits against a quote in this
// file's patch text - that sequence is a substitution token to
// patch_git_file and once shipped a broken page (BROWSER_TESTS.md:265).
+ '<div><div class="big">' + '
// The price as the server computes it NOW. price_usd is stamped on the row
// when the project is created, so it goes stale the moment the markup
// constant changes - which it just did, from 5x to actual cost.
var price = (r.quote && typeof r.quote.price_usd === 'number')
? r.quote.price_usd : Number(p.price_usd || 0);
+ '<div><div class="big">&#36;' + Number(price).toFixed(2) + '</div>'
+ '<div class="sub">' + videoSecondsOf(p) + ' seconds · ' + (p.segments || 4) + ' shots'
+ (modelFor(p) ? ' · ' + esc(modelFor(p).label) : '') + '</div></div>'
+ '<div class="sub">' + (canEditScript
@ -1660,7 +1666,11 @@ load();
</script>
</body>
</html>
+ Number(price).toFixed(2) + '</div>'
<!-- Everything below is a duplicate of this page, spliced in by a bad patch:
a dollar sign before a quote is a substitution token to patch_git_file.
It is commented out to the end of the file. The live copy is ABOVE.
+ '<div class="sub">' + videoSecondsOf(p) + ' seconds · ' + (p.segments || 4) + ' shots'
+ (modelFor(p) ? ' · ' + esc(modelFor(p).label) : '') + '</div></div>'
+ '<div class="sub">' + (canEditScript