Skip to content

Render helper proxy fix#698

Merged
feruzm merged 3 commits into
developfrom
render
Mar 9, 2026
Merged

Render helper proxy fix#698
feruzm merged 3 commits into
developfrom
render

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Mar 9, 2026

Summary by CodeRabbit

  • Chores
    • Bumped web package version to 4.3.7 and render helper to 2.4.22.
  • Bug Fixes
    • Refined image URL proxification rules to cover additional URL patterns while preserving intended exceptions.
  • Documentation
    • Added a changelog entry for the render helper patch.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 9, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b8bdee9c-74b2-4668-97ca-60cfb0ffed33

📥 Commits

Reviewing files that changed from the base of the PR and between f53041c and 4eeae0b.

⛔ Files ignored due to path filters (6)
  • packages/render-helper/dist/browser/index.js is excluded by !**/dist/**
  • packages/render-helper/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/render-helper/dist/node/index.cjs is excluded by !**/dist/**
  • packages/render-helper/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/render-helper/dist/node/index.mjs is excluded by !**/dist/**
  • packages/render-helper/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (2)
  • packages/render-helper/CHANGELOG.md
  • packages/render-helper/package.json

📝 Walkthrough

Walkthrough

Version bump for apps/web package. Modified image proxy heuristics in render-helper to skip proxification only for specific Ecency image subpaths (/p/, /u/) and dimension-patterned URLs, causing broader proxification of other Ecency and non-Ecency URLs.

Changes

Cohort / File(s) Summary
Version Bump
apps/web/package.json
Incremented package version from 4.3.6 to 4.3.7.
Image Proxy Logic
packages/render-helper/src/methods/img.method.ts
Refined proxy-bypass conditions: only URLs beginning with https://images.ecency.com/p/, https://images.ecency.com/u/, or matching https://images.ecency.com/{digits}x{digits}/ are excluded from proxification; other URLs (including direct upload paths) will be proxified. Comments clarify intent.
Render Helper Release
packages/render-helper/CHANGELOG.md, packages/render-helper/package.json
Bumped render-helper version to 2.4.22 and added changelog entry "Render helper proxy fix (#698)".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Alternative image proxy #673: Related to image proxy/proxification integration; touches routing and configuration for using render-helper's proxy behavior.

Poem

🐇 I hopped through lines of code tonight,
Tweaked which pictures take the proxy flight,
Some Ecency paths I let pass by,
Others I shepherd through the sky —
A rabbit's nibble, tidy and light. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Render helper proxy fix' is directly related to the main change, which modifies the proxy-check logic in the render helper to fix proxification behavior for Ecency image URLs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch render

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/render-helper/src/methods/img.method.ts (1)

58-71: Consider adding the same hasAlreadyProxied check here for consistency.

Unlike the img() function above, createImageHTML() doesn't check whether the URL is already proxied before calling proxifyImageSrc(). If a user pastes an already-proxied URL (e.g., https://images.ecency.com/p/...) into their content, this could result in double-proxification.

♻️ Suggested fix to add proxy-skip check
 export function createImageHTML(src: string, isLCP: boolean): string {
+  // Skip re-proxification for URLs already going through proxy/avatar/cover routes
+  const hasAlreadyProxied = src.startsWith("https://images.ecency.com/p/")
+    || src.startsWith("https://images.ecency.com/u/")
+    || /^https:\/\/images\.ecency\.com\/\d+x\d+\//.test(src);
+
+  const proxified = hasAlreadyProxied ? src : proxifyImageSrc(src);
-  const proxified = proxifyImageSrc(src);
   if (!proxified) return '';
 
   const loading = isLCP ? 'eager' : 'lazy';

Alternatively, extract the check into a shared helper to keep both functions in sync.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/render-helper/src/methods/img.method.ts` around lines 58 - 71,
createImageHTML currently calls proxifyImageSrc(src) unconditionally which can
double-proxy already-proxied URLs; before proxifying, check the same condition
used in img() (the hasAlreadyProxied check) and skip proxifyImageSrc if true,
returning an empty string or the original proxied src as appropriate, or factor
the logic into a shared helper to keep createImageHTML and img() consistent
(reference createImageHTML, proxifyImageSrc, and the hasAlreadyProxied check
used in img()).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/render-helper/src/methods/img.method.ts`:
- Around line 58-71: createImageHTML currently calls proxifyImageSrc(src)
unconditionally which can double-proxy already-proxied URLs; before proxifying,
check the same condition used in img() (the hasAlreadyProxied check) and skip
proxifyImageSrc if true, returning an empty string or the original proxied src
as appropriate, or factor the logic into a shared helper to keep createImageHTML
and img() consistent (reference createImageHTML, proxifyImageSrc, and the
hasAlreadyProxied check used in img()).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 999d61a1-90f7-45fc-bcbb-761167b6b98d

📥 Commits

Reviewing files that changed from the base of the PR and between 0239656 and f53041c.

📒 Files selected for processing (2)
  • apps/web/package.json
  • packages/render-helper/src/methods/img.method.ts

@feruzm feruzm added patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR labels Mar 9, 2026
@feruzm feruzm merged commit 97d2a85 into develop Mar 9, 2026
1 check was pending
@feruzm feruzm deleted the render branch March 9, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant