2 Commits

Author SHA1 Message Date
f298e4a2a6 fix: resolve heredoc parsing error in deploy-oci Makefile target
All checks were successful
Deploy to OCI / deploy (push) Successful in 51s
Extract inline Dockerfile to Dockerfile.oci and scp it instead of
generating it via heredoc over SSH. Make's line-continuation backslash
was causing the heredoc delimiter to be parsed as 'DEOFnFROM' by the
remote shell, breaking the image build step.
2026-04-09 20:32:23 +00:00
b58ba41458 fix: cap watermark dimensions to prevent RangeError on large files
Some checks failed
Deploy to OCI / deploy (push) Failing after 40s
buildWatermark() calls Array.join() on a lines array whose size is
derived from tile dimensions divided by wmFontSize. For files with very
many lines the codeFontSize (and thus wmFontSize) approaches zero,
making charsPerLine and lineCount astronomically large and blowing past
JS's string length limit.

Fix by:
1. Clamping wmFontSize to a minimum of 1.0 to handle pathologically
   large files.
2. Capping charsPerLine at 400 and lineCount at 150 — the watermark is
   purely decorative so this cap has no visible impact.
2026-04-07 10:56:02 +01:00

View File

@@ -302,11 +302,12 @@ export class RepoRenderer {
// Watermark — tiled path text, 45° rotated, slightly larger than code font // Watermark — tiled path text, 45° rotated, slightly larger than code font
if (!tile.watermark) { if (!tile.watermark) {
const codeFontSize = (d.h / d.lines) * 0.65; const codeFontSize = (d.h / d.lines) * 0.65;
const wmFontSize = codeFontSize * 2.5; // Clamp wmFontSize to avoid degenerate tiny values on files with huge line counts
const wmFontSize = Math.max(codeFontSize * 2.5, 1.0);
const wmLabel = `${this.repoName}/${d.path}`; const wmLabel = `${this.repoName}/${d.path}`;
// Estimate how many repetitions to fill the area // Estimate how many repetitions to fill the area; cap to prevent RangeError on massive tiles
const charsPerLine = Math.ceil(Math.max(d.w, d.h) * 1.5 / (wmFontSize * 0.5)); const charsPerLine = Math.min(Math.ceil(Math.max(d.w, d.h) * 1.5 / (wmFontSize * 0.5)), 400);
const lineCount = Math.ceil(Math.max(d.w, d.h) * 1.5 / (wmFontSize * 1.5)); const lineCount = Math.min(Math.ceil(Math.max(d.w, d.h) * 1.5 / (wmFontSize * 1.5)), 150);
const wmContent = buildWatermark(wmLabel, charsPerLine, lineCount); const wmContent = buildWatermark(wmLabel, charsPerLine, lineCount);
const wm = new Text(); const wm = new Text();