Skip to content

Commit 7739317

Browse files
author
Justin Mahar
committed
Organize; add comment
1 parent adaa138 commit 7739317

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

src/components/embeds/FacebookEmbed.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ export const FacebookEmbed = ({
174174
height: isPercentageHeight
175175
? '100%'
176176
: typeof height !== 'undefined'
177-
? height
178-
: typeof divProps.style?.height !== 'undefined' || typeof divProps.style?.maxHeight !== 'undefined'
179-
? '100%'
180-
: defaultPlaceholderHeight,
177+
? height
178+
: typeof divProps.style?.height !== 'undefined' || typeof divProps.style?.maxHeight !== 'undefined'
179+
? '100%'
180+
: defaultPlaceholderHeight,
181181
border: '1px solid #dee2e6',
182182
borderRadius,
183183
};

src/components/embeds/InstagramEmbed.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ export const InstagramEmbed = ({
174174
height: isPercentageHeight
175175
? '100%'
176176
: typeof height !== 'undefined'
177-
? height
178-
: typeof divProps.style?.height !== 'undefined' || typeof divProps.style?.maxHeight !== 'undefined'
179-
? '100%'
180-
: defaultPlaceholderHeight,
177+
? height
178+
: typeof divProps.style?.height !== 'undefined' || typeof divProps.style?.maxHeight !== 'undefined'
179+
? '100%'
180+
: defaultPlaceholderHeight,
181181
border: '1px solid #dee2e6',
182182
borderRadius,
183183
};

src/components/embeds/LinkedInEmbed.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export const LinkedInEmbed = ({
4848
typeof height !== 'undefined'
4949
? height
5050
: typeof divProps.style?.height !== 'undefined' || typeof divProps.style?.maxHeight !== 'undefined'
51-
? '100%'
52-
: defaultPlaceholderHeight,
51+
? '100%'
52+
: defaultPlaceholderHeight,
5353
border: 'solid 1px rgba(0, 0, 0, 0.15)',
5454
borderRadius,
5555
};

src/components/embeds/PinterestEmbed.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export const PinterestEmbed = ({
4848
typeof height !== 'undefined'
4949
? height
5050
: typeof divProps.style?.height !== 'undefined' || typeof divProps.style?.maxHeight !== 'undefined'
51-
? '100%'
52-
: defaultPlaceholderHeight,
51+
? '100%'
52+
: defaultPlaceholderHeight,
5353
border: 'solid 1px rgba(0, 0, 0, 0.15)',
5454
borderRadius,
5555
};

src/components/embeds/TikTokEmbed.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ export const TikTokEmbed = ({
133133
typeof height !== 'undefined'
134134
? height
135135
: typeof divProps.style?.height !== 'undefined' || typeof divProps.style?.maxHeight !== 'undefined'
136-
? '100%'
137-
: defaultPlaceholderHeight,
136+
? '100%'
137+
: defaultPlaceholderHeight,
138138
border: 'solid 1px rgba(22,24,35,0.12)',
139139
borderRadius,
140140
};

src/components/placeholder/PlaceholderEmbed.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import { BorderSpinner } from './parts/BorderSpinner';
66
import { EngagementIconsPlaceholder } from './parts/EngagementIconsPlaceholder';
77
import { ProfilePlaceholder } from './parts/ProfilePlaceholder';
88

9-
const isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i
9+
// See: https://pragmaticwebsecurity.com/articles/spasecurity/react-xss-part1
10+
const isJavaScriptProtocol =
11+
/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
1012

1113
export interface PlaceholderEmbedProps extends DivProps {
1214
url: string;
@@ -26,7 +28,6 @@ export const PlaceholderEmbed = ({
2628
spinnerDisabled,
2729
...divProps
2830
}: PlaceholderEmbedProps) => {
29-
3031
if (isJavaScriptProtocol.test(url) && !allowJavaScriptUrls) {
3132
console.warn(`PlaceholderEmbed has blocked a javascript: URL as a security precaution`);
3233
return null;

0 commit comments

Comments
 (0)