Fix image testing regex.
This commit is contained in:
parent
862321aa39
commit
eead117d6b
2 changed files with 5 additions and 5 deletions
4
ui/src/components/post-listing.tsx
vendored
4
ui/src/components/post-listing.tsx
vendored
|
@ -187,7 +187,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
onClick={linkEvent(this, this.handleImageExpandClick)}
|
onClick={linkEvent(this, this.handleImageExpandClick)}
|
||||||
>
|
>
|
||||||
{this.imgThumbnail()}
|
{this.imgThumbnail()}
|
||||||
<svg class="icon rounded link-overlay hover-link">
|
<svg class="icon thumbnail rounded link-overlay hover-link">
|
||||||
<use xlinkHref="#icon-image"></use>
|
<use xlinkHref="#icon-image"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
|
@ -199,7 +199,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
title={this.state.url}
|
title={this.state.url}
|
||||||
>
|
>
|
||||||
{this.imgThumbnail()}
|
{this.imgThumbnail()}
|
||||||
<svg class="icon rounded link-overlay hover-link">
|
<svg class="icon thumbnail rounded link-overlay hover-link">
|
||||||
<use xlinkHref="#icon-external-link"></use>
|
<use xlinkHref="#icon-external-link"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
|
|
6
ui/src/utils.ts
vendored
6
ui/src/utils.ts
vendored
|
@ -159,10 +159,10 @@ export function isMod(modIds: Array<number>, creator_id: number): boolean {
|
||||||
return modIds.includes(creator_id);
|
return modIds.includes(creator_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
var imageRegex = new RegExp(
|
const imageRegex = new RegExp(
|
||||||
`(http)?s?:?(\/\/[^"']*\.(?:png|jpg|jpeg|gif|png|svg))`
|
/(http)?s?:?(\/\/[^"']*\.(?:jpg|jpeg|gif|png|svg))/
|
||||||
);
|
);
|
||||||
var videoRegex = new RegExp(`(http)?s?:?(\/\/[^"']*\.(?:mp4))`);
|
const videoRegex = new RegExp(`(http)?s?:?(\/\/[^"']*\.(?:mp4))`);
|
||||||
|
|
||||||
export function isImage(url: string) {
|
export function isImage(url: string) {
|
||||||
return imageRegex.test(url);
|
return imageRegex.test(url);
|
||||||
|
|
Loading…
Reference in a new issue