Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to configure url prefix ( Non-alignment with sitecore) #193

Closed
RashmiSrinivas1 opened this issue May 22, 2019 · 1 comment
Closed
Assignees

Comments

@RashmiSrinivas1
Copy link

RashmiSrinivas1 commented May 22, 2019

Is your feature request related to a problem? Please describe.

Currently from (jss/packages/sitecore-jss/src/mediaApi.ts) we have a regex:

// finds the Sitecore media URL prefix
const mediaUrlPrefixRegex = //([-~]{1})/media//i;

This Url prefix is configurable in Sitecore but not from jss as it is hardcoded in the regex pattern. Would it be possible to make these Url prefix configurable?

Describe the solution you'd like

I should be able to configure the urls and handle the request appropriately as we handle in Sitecore.

Ex: We should be handle /-assets/

Describe alternatives you've considered

We are currently looking at the options to resolve this issue:

  1. Fork and amend the existing code ?
  2. Rewrite the url to handle the requests?

Additional information

N/A

@RashmiSrinivas1 RashmiSrinivas1 changed the title Unable to configure url prefix ( miss-alignment with sitecore) Unable to configure url prefix ( Non-alignment with sitecore) May 22, 2019
@sc-illiakovalenko sc-illiakovalenko self-assigned this Jul 21, 2020
@sc-illiakovalenko
Copy link
Contributor

@RashmiSrinivas1 Feature added in #419
You will have ability to use mediaUrlPrefix in the Image component, in all frameworks.

  /**
   * Custom regexp that finds media URL prefix that will be replaced by `/-/jssmedia` or `/~/jssmedia`.
   * @example
   * /\/([-~]{1})assets\//i
   * /-assets/website -> /-/jssmedia/website
   * /~assets/website -> /~/jssmedia/website
   */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants