X Tutup
Skip to content

Fix richtext img url converting when branch name has a slash#329

Open
nyany wants to merge 1 commit intopages-cms:developmentfrom
nyany:issue/img-url-richtext-fix
Open

Fix richtext img url converting when branch name has a slash#329
nyany wants to merge 1 commit intopages-cms:developmentfrom
nyany:issue/img-url-richtext-fix

Conversation

@nyany
Copy link

@nyany nyany commented Nov 9, 2025

The issue:

the "raw.githubusercontent" url is not replaced with the config's "output" property. Happens only with slash-containing branches like feature/onetwothree

Try to save this:

image

The result:

instead of url in format of $output/$relativeUrl it's https://raw.github...../$relativeUrl

image

Reproduction steps:

  1. use a branch containing a slash (e.g. feature/foobar). Branches like develop or feature_one-123 are fine.
  2. edit rich-text body field of either a collection or a single md. It must be a body field. It doesn't affect the rich-text when used in a block field.
  3. add an image to the body.
  4. save
  5. the non-converted URL is committed.

Fix:

githubImage.ts already has encodePath function which seems to handle this problem.

commit: 3b735b0 seems to fix some bug (but doesn't say what that is). Is there a reason why it's specifically encodeURIComponent and not the encodePath function that was already there?

Shouldn't encodePath be used everywhere in githubImage.ts instead of encodeURIComponent?

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.

1 participant

X Tutup