[fix] Encode URL in background-image CSS property

Solution based on
https://stackoverflow.com/questions/25613552/how-should-i-escape-image-urls-for-css

Close #2286
This commit is contained in:
Matias Lang
2022-06-10 13:16:24 -07:00
committed by Nicolas Gallagher
parent cb8381af7b
commit 91fc3c7aab
+1 -1
View File
@@ -193,7 +193,7 @@ const Image: React.AbstractComponent<ImageProps, React.ElementRef<typeof View>>
const selectedSource = shouldDisplaySource ? source : defaultSource;
const displayImageUri = resolveAssetUri(selectedSource);
const imageSizeStyle = resolveAssetDimensions(selectedSource);
const backgroundImage = displayImageUri ? `url("${displayImageUri}")` : null;
const backgroundImage = displayImageUri ? `url("${encodeURI(displayImageUri)}")` : null;
const backgroundSize = getBackgroundSize();
// Accessibility image allows users to trigger the browser's image context menu