From eead117d6b54298f86daa161be752096113fa1a7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 27 Feb 2020 15:00:41 -0500 Subject: [PATCH] Fix image testing regex. --- ui/src/components/post-listing.tsx | 4 ++-- ui/src/utils.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index ef1dfd60..8dbe1f48 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -187,7 +187,7 @@ export class PostListing extends Component { onClick={linkEvent(this, this.handleImageExpandClick)} > {this.imgThumbnail()} - + @@ -199,7 +199,7 @@ export class PostListing extends Component { title={this.state.url} > {this.imgThumbnail()} - + diff --git a/ui/src/utils.ts b/ui/src/utils.ts index d329dcd5..9d2798ef 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -159,10 +159,10 @@ export function isMod(modIds: Array, creator_id: number): boolean { return modIds.includes(creator_id); } -var imageRegex = new RegExp( - `(http)?s?:?(\/\/[^"']*\.(?:png|jpg|jpeg|gif|png|svg))` +const imageRegex = new RegExp( + /(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) { return imageRegex.test(url); -- 2.44.1