fix url for https
This commit is contained in:
@@ -2,9 +2,6 @@ package marketing.heyday.hartmann.fotodocumentation.rest.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import marketing.heyday.hartmann.fotodocumentation.core.model.Picture;
|
||||
|
||||
@@ -20,19 +17,16 @@ import marketing.heyday.hartmann.fotodocumentation.core.model.Picture;
|
||||
|
||||
@Schema(name = "Picture")
|
||||
public record PictureValue(Long id, String comment, String category, Date pictureDate, String username, Integer evaluation, String imageUrl, String normalSizeUrl, String thumbnailSizeUrl) {
|
||||
private static final Log LOG = LogFactory.getLog(PictureValue.class);
|
||||
|
||||
|
||||
public static PictureValue builder(Picture picture, String baseUrl) {
|
||||
if (picture == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LOG.error("baseUrl " + baseUrl);
|
||||
String sizeUrl = baseUrl;
|
||||
// we need to rewrite the url for dev/integ/prod since the Wildfly doesn't know we are running the nginx on https. Without the https the images are not shown
|
||||
if(baseUrl.startsWith("http://") && !baseUrl.startsWith("http://localhost")){
|
||||
LOG.error("starts with http:// ");
|
||||
sizeUrl = "https://" + baseUrl.substring(7);
|
||||
LOG.error("new baseUrl " + sizeUrl);
|
||||
}
|
||||
|
||||
sizeUrl = sizeUrl + "picture/image/" + picture.getPictureId() + "?size=";
|
||||
|
||||
Reference in New Issue
Block a user