From 9191a5a65a54c9e1c6cfe64c4ddd34c8d8a113b2 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 1 Jun 2021 17:32:27 -0700 Subject: [PATCH] Add UI for already converted outfit URLs When the outfit image URL is already converted, we show a happy no-change message! --- src/app/OutfitUrlsPage.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/OutfitUrlsPage.js b/src/app/OutfitUrlsPage.js index 4067a18..88f5161 100644 --- a/src/app/OutfitUrlsPage.js +++ b/src/app/OutfitUrlsPage.js @@ -401,6 +401,7 @@ function BulkImageConverter() { const S3_OUTFIT_URL_EXACT_PATTERN = /^https?:\/\/openneo-uploads\.s3\.amazonaws\.com\/outfits\/([0-9]{3})\/([0-9]{3})\/([0-9]{3})\/(preview|medium_preview|small_preview)\.png$/; const S3_OUTFIT_URL_GLOBAL_PATTERN = /https?:\/\/openneo-uploads\.s3\.amazonaws\.com\/outfits\/([0-9]{3})\/([0-9]{3})\/([0-9]{3})\/(preview|medium_preview|small_preview)\.png/g; const OUTFIT_PAGE_URL_EXACT_PATTERN = /^https?:\/\/impress(-2020)?\.openneo\.net\/outfits\/([0-9]+)(\?.*)?$/; +const CONVERTED_OUTFIT_URL_EXACT_PATTERN = /^https?:\/\/impress-outfit-images\.openneo\.net\/outfits\/([0-9]+)\/(150|300|600)\.png$/; const S3_FILENAMES_TO_SIZES = { preview: 600, medium_preview: 300, @@ -420,6 +421,14 @@ function parseS3OutfitUrl(url) { ); } + const convertedImageMatch = url.match(CONVERTED_OUTFIT_URL_EXACT_PATTERN); + if (convertedImageMatch) { + throw new UrlAlreadyConvertedError( + `This URL is already in the new format!`, + convertedImageMatch[1] + ); + } + const match = url.match(S3_OUTFIT_URL_EXACT_PATTERN); if (!match) { throw new Error(