Unverified Commit 609f2144 authored by gaoyan's avatar gaoyan Committed by GitHub

[Fix]Fix Email smtpSslTrust NPE (#2979)

parent e0ba0c54
...@@ -44,5 +44,5 @@ public class EmailParams { ...@@ -44,5 +44,5 @@ public class EmailParams {
private boolean sslEnable; private boolean sslEnable;
private String user; private String user;
private String password; private String password;
private String smtpSslTrust; private String smtpSslTrust = "";
} }
...@@ -32,6 +32,7 @@ import java.util.Set; ...@@ -32,6 +32,7 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.text.StrFormatter;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
/** /**
...@@ -50,16 +51,14 @@ public class URLUtils { ...@@ -50,16 +51,14 @@ public class URLUtils {
try { try {
URL url = new URL(urlPath); URL url = new URL(urlPath);
URLConnection urlConnection = url.openConnection(); URLConnection urlConnection = url.openConnection();
if ("http".equals(url.getProtocol()) if ("rs".equals(url.getProtocol())) {
|| "https".equals(url.getProtocol())
|| "hdfs".equals(url.getProtocol())) {
} else if ("rs".equals(url.getProtocol())) {
String path = StrUtil.join(File.separator, TMP_PATH, "rs", url.getPath()); String path = StrUtil.join(File.separator, TMP_PATH, "rs", url.getPath());
return FileUtil.writeFromStream(urlConnection.getInputStream(), path); return FileUtil.writeFromStream(urlConnection.getInputStream(), path);
} else if ("file".equals(url.getProtocol())) { } else if ("file".equals(url.getProtocol())) {
return new File(url.getPath()); return new File(url.getPath());
} }
return null; throw new RuntimeException(StrFormatter.format(
"The path {} unsupported protocol: {},please use rs:// or file://", urlPath, url.getProtocol()));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -106,12 +106,15 @@ export const FormSingleColumnList = (props: FormSingleColumnListProps) => { ...@@ -106,12 +106,15 @@ export const FormSingleColumnList = (props: FormSingleColumnListProps) => {
onClick={async () => { onClick={async () => {
// 获取前一项的值 // 获取前一项的值
const lastItem = fields[fields.length === 0 ? 0 : fields.length - 1]; const lastItem = fields[fields.length === 0 ? 0 : fields.length - 1];
if (!lastItem) {
add();
return;
}
const addBeforePreItem = form.getFieldValue([...namePath, lastItem.name]); const addBeforePreItem = form.getFieldValue([...namePath, lastItem.name]);
if (!addBeforePreItem) { if (!addBeforePreItem) {
await ErrorMessageAsync(l('rc.ai.previousItemRequired')); await ErrorMessageAsync(l('rc.ai.previousItemRequired'));
return; return;
} else if (fields.length >= max) { } else if (fields.length >= max) {
console.log(fields.length);
await ErrorMessageAsync(l('rc.ai.atMost', '', { max })); await ErrorMessageAsync(l('rc.ai.atMost', '', { max }));
return; return;
} else { } else {
......
...@@ -123,7 +123,7 @@ const Email = (props: EmailProps) => { ...@@ -123,7 +123,7 @@ const Email = (props: EmailProps) => {
inputPlaceholder={l('rc.ai.receiverCcsPleaseHolder')} inputPlaceholder={l('rc.ai.receiverCcsPleaseHolder')}
title={l('rc.ai.receiverCcsMax', '', { max: 10 })} title={l('rc.ai.receiverCcsMax', '', { max: 10 })}
max={10} max={10}
min={1} min={0}
plain={true} plain={true}
/> />
</ProCard> </ProCard>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment