fix roll view log null exception (#8914)
parent
e53ac4e304
commit
5ad73f8352
|
|
@ -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…
Reference in New Issue