Skip to content

Commit

Permalink
feat(react-imgix-bg): optionally disable path encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
sherwinski authored and luqven committed Jan 11, 2023
1 parent efa0eeb commit 4a1e206
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/react-imgix-bg.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class BackgroundImpl extends React.Component {
imgixParams = {},
onLoad,
disableLibraryParam,
disablePathEncoding,
src,
children,
className = "",
Expand Down Expand Up @@ -154,7 +155,7 @@ class BackgroundImpl extends React.Component {

const renderedSrc = (() => {
const [rawSrc, params] = extractQueryParams(src);
const srcOptions = {
const longImgixParams = {
...params,
fit: "crop",
...imgixParams,
Expand All @@ -164,7 +165,11 @@ class BackgroundImpl extends React.Component {
dpr,
};

return constructUrl(rawSrc, srcOptions);
const srcOptions = {
disablePathEncoding,
}

return constructUrl(rawSrc, longImgixParams, srcOptions);
})();

const style = {
Expand Down

0 comments on commit 4a1e206

Please sign in to comment.