Skip to content

Commit

Permalink
#30804 include in 23.10.24 LTS
Browse files Browse the repository at this point in the history
  • Loading branch information
erickgonzalez committed Jan 16, 2025
1 parent 88f1deb commit 7166eb1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions dotCMS/hotfix_tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,4 @@ This maintenance release includes the following code fixes:
182. https://github.com/dotCMS/core/issues/28780 : Add Hint support for relationship fields #28780
183. https://github.com/dotCMS/core/issues/30457 : FileAssetContainers not found when using case #30457
184. https://github.com/dotCMS/core/issues/30969 : SAML: Retrieve the relay state on the SAML Endpoint #30969
185. https://github.com/dotCMS/core/issues/30804 : The file with name of webPageContent.vtl can't GET and throws 404 #30804
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public Uri(String uri, int expectedWidth, int expectedHeight, int expectedMaxWid
quality = servlet.getQuality(uri, 0);
cropWidth = servlet.cropWidth(uri);
cropHeight = servlet.cropHeight(uri);
jpeg = uri.contains("jpg");
webp = uri.contains("webp");
jpeg = uri.contains(".jpg");
webp = uri.contains(".webp");
isImage = webp || jpeg || width+height+maxWidth+maxHeight +minHeight+minWidth> 0 || quality>0 || cropHeight>0 || cropWidth>0;
}
}
Expand Down Expand Up @@ -303,5 +303,17 @@ public void test_ShortyServlet_Process_Correct_Uri(Uri uri) {


}

/**
* Method to test: {@link ShortyServlet#doForward(HttpServletRequest, HttpServletResponse, String, String, boolean, Optional)}
* Given Scenario: A uri of a file that is called or contains webp is passed to the method
* ExpectedResult: The method shouldn't consider the file as an image for containing the word webp, so the result should be false
*
*/
@Test
public void test_webp_file_name(){
Uri uri = new Uri("/data/shared/assets/tmp_upload/temp_2e1056205c/webPageContent.vtl", 0, 0, 0, 0, 0, 0, 0, 0, 0, false);
assertEquals(uri.isImage, uri.expectedIsImage);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public class ShortyServlet extends HttpServlet {
private final ShortyIdAPI shortyIdAPI = APILocator.getShortyAPI();


private static final String JPEG = "jpeg";
private static final String JPEGP = "jpegp";
private static final String WEBP = "webp";
private static final String JPEG = ".jpeg";
private static final String JPEGP = ".jpegp";
private static final String WEBP = ".webp";
private static final String FILE_ASSET_DEFAULT = FileAssetAPI.BINARY_FIELD;
public static final String SHORTY_SERVLET_FORWARD_PATH = "shorty.servlet.forward.path";
private static final Pattern widthPattern = Pattern.compile("/(\\d+)w\\b");
Expand Down

0 comments on commit 7166eb1

Please sign in to comment.