diff --git a/src/protagonist/API/Features/Image/ImageController.cs b/src/protagonist/API/Features/Image/ImageController.cs index b76da9c80..2456b6279 100644 --- a/src/protagonist/API/Features/Image/ImageController.cs +++ b/src/protagonist/API/Features/Image/ImageController.cs @@ -100,12 +100,6 @@ public async Task GetImage(int customerId, int spaceId, string im hydraAsset = LegacyModeConverter.VerifyAndConvertToModernFormat(hydraAsset); } - if(hydraAsset.ImageOptimisationPolicy != null || hydraAsset.ThumbnailPolicy != null) - { - return this.HydraProblem("ImageOptimisationPolicy and ThumbnailPolicy are disabled", null, - 400, "Bad Request"); - } - if (hydraAsset.ModelId == null) { hydraAsset.ModelId = imageId; diff --git a/src/protagonist/API/Features/Image/Validation/HydraImageValidator.cs b/src/protagonist/API/Features/Image/Validation/HydraImageValidator.cs index ea3816c84..379210282 100644 --- a/src/protagonist/API/Features/Image/Validation/HydraImageValidator.cs +++ b/src/protagonist/API/Features/Image/Validation/HydraImageValidator.cs @@ -30,6 +30,17 @@ public HydraImageValidator(IOptions apiSettings) When(a => !a.DeliveryChannels.IsNullOrEmpty(), ImageDeliveryChannelDependantValidation); + // Legacy policy fields + RuleFor(a => a.ImageOptimisationPolicy) + .Null() + .When(_ => !apiSettings.Value.EmulateOldDeliveryChannelProperties) + .WithMessage("'ImageOptimisationPolicy' is disabled"); + + RuleFor(a => a.ThumbnailPolicy) + .Null() + .When(_ => !apiSettings.Value.EmulateOldDeliveryChannelProperties) + .WithMessage("'ThumbnailPolicy' is disabled"); + // System edited fields RuleFor(a => a.Width).Empty().WithMessage("Should not include width"); RuleFor(a => a.Height).Empty().WithMessage("Should not include height"); diff --git a/src/protagonist/API/Settings/ApiSettings.cs b/src/protagonist/API/Settings/ApiSettings.cs index d2979625d..483075231 100644 --- a/src/protagonist/API/Settings/ApiSettings.cs +++ b/src/protagonist/API/Settings/ApiSettings.cs @@ -106,8 +106,8 @@ public string RestrictedAssetIdCharacterString } /// - /// Whether incoming old delivery channel properties (e.g wcDeliveryChannels, imageOptimisationPolicy, - /// thumbnailPolicy) are supported and translated into the new format + /// Whether old delivery channel properties (e.g imageOptimisationPolicy, thumbnailPolicy) + /// on legacy payloads are supported and translated into the new format /// - public bool EmulateOldDeliveryChannelProperties { get; set; } = false; + public bool EmulateOldDeliveryChannelProperties { get; set; } } \ No newline at end of file