Browse Source

fix roll view log null exception (#8914)

3.0.0/version-upgrade
Kerwin 3 years ago committed by GitHub
parent
commit
5ad73f8352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java

5
dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java

@ -32,6 +32,8 @@ import org.apache.dolphinscheduler.remote.command.log.ViewLogResponseCommand;
import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor;
import org.apache.dolphinscheduler.remote.utils.Constants; import org.apache.dolphinscheduler.remote.utils.Constants;
import org.apache.commons.lang3.StringUtils;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -146,6 +148,9 @@ public class LoggerRequestProcessor implements NettyRequestProcessor {
*/ */
private boolean checkPathSecurity(String path) { private boolean checkPathSecurity(String path) {
String dsHome = System.getProperty("DOLPHINSCHEDULER_WORKER_HOME"); String dsHome = System.getProperty("DOLPHINSCHEDULER_WORKER_HOME");
if (StringUtils.isBlank(dsHome)) {
dsHome = System.getProperty("user.dir");
}
if (path.startsWith(dsHome) && !path.contains("../") && path.endsWith(".log")) { if (path.startsWith(dsHome) && !path.contains("../") && path.endsWith(".log")) {
return true; return true;
} }

Loading…
Cancel
Save