From fab10ef792a56f6c333e870415a7c3bfc768cfca 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 ef1dfd6..8dbe1f4 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 d329dcd..9d2798e 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);