mraible commented on code in PR #310:
URL: https://github.com/apache/roller/pull/310#discussion_r4609093525


##########
app/src/main/java/org/apache/roller/weblogger/ui/core/filters/LoadSaltFilter.java:
##########
@@ -35,12 +35,15 @@ public class LoadSaltFilter implements Filter {
 
     static final String RENDERING_PATH = "/roller-ui/rendering/";
 
+    /** Roller UI static files, which never hold a form. */
+    static final String[] STATIC_PATHS = {"/roller-ui/styles/", 
"/roller-ui/scripts/", "/roller-ui/images/"};

Review Comment:
   Added /roller-ui/theme/ to the skipped paths, and the static-files test now 
requests /roller-ui/theme/tan/menutab-sel.gif, which fails without the change. 
#300 now skips /roller-ui/theme/** in its static-resource rule too, with a test.



##########
app/src/test/java/org/apache/roller/weblogger/ui/core/filters/LoadSaltFilterTest.java:
##########
@@ -162,6 +162,23 @@ void forwardedCommentPostsGetNoSessionAndNoSalt() throws 
Exception {
         }
     }
 
+    @Test
+    void staticFilesGetNoSessionAndNoSalt() throws Exception {
+        try (MockedStatic<SaltCache> mockedSaltCache = 
mockStatic(SaltCache.class)) {
+            mockedSaltCache.when(SaltCache::getInstance).thenReturn(saltCache);
+            for (String path : new String[] {"/roller-ui/styles/roller.css", 
"/roller-ui/scripts/date-fields.js",
+                    "/roller-ui/images/feather.svg"}) {
+                when(request.getServletPath()).thenReturn(path);
+                filter.doFilter(request, response, chain);
+            }
+
+            verify(request, never()).getSession(true);
+            verify(request, never()).getSession();
+            verify(request, never()).setAttribute(eq("salt"), anyString());
+            verify(saltCache, never()).put(anyString(), anyString());

Review Comment:
   The static-files test now checks that all four requests reach the filter 
chain, and a new test checks that /roller-ui/styles-settings.rol still gets a 
session and a salt, matching #332.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to