IDEA-155360 Open In Browser : files from library jars cannot be opened
[idea/community.git] / platform / built-in-server / src / org / jetbrains / builtInWebServer / DefaultWebServerPathHandler.kt
index e88bb2c9819340c329c44d654e8e0baef4839513..7f8c575a1a9bacdd02fc31b57ae58d12d01f38ba 100644 (file)
@@ -41,7 +41,8 @@ private class DefaultWebServerPathHandler : WebServerPathHandler() {
                        projectName: String,
                        decodedRawPath: String,
                        isCustomHost: Boolean): Boolean {
-    val extraHttpHeaders = validateToken(request, context.channel()) ?: return true
+    val isSignedRequest = request.isSignedRequest()
+    val extraHttpHeaders = validateToken(request, context.channel(), isSignedRequest) ?: return true
 
     val channel = context.channel()
     val pathToFileManager = WebServerPathToFileManager.getInstance(project)
@@ -89,7 +90,7 @@ private class DefaultWebServerPathHandler : WebServerPathHandler() {
     }
 
     // if extraHttpHeaders is not empty, it means that we get request wih token in the query
-    if (extraHttpHeaders.isEmpty && request.origin == null && request.referrer == null && request.isRegularBrowser() && !canBeAccessedDirectly(pathInfo.name)) {
+    if (!isSignedRequest && request.origin == null && request.referrer == null && request.isRegularBrowser() && !canBeAccessedDirectly(pathInfo.name)) {
       HttpResponseStatus.NOT_FOUND.send(context.channel(), request)
       return true
     }