Add UI for already converted outfit URLs

When the outfit image URL is already converted, we show a happy no-change message!
This commit is contained in:
Emi Matchu 2021-06-01 17:32:27 -07:00
parent 1865d62945
commit 9191a5a65a

View file

@ -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(