Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持中文项目及工作流名称,针对dss中 的issues#279工程名与工作流名中文问题 #53

Open
wants to merge 1 commit into
base: branch-0.6.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions azkaban-common/src/main/java/azkaban/project/ProjectManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ public Project createProject(final String projectName, final String description,
throw new ProjectManagerException("项目描述不能为空.");
} else if (creator == null) {
throw new ProjectManagerException("必须使用有效用户创建项目.");
} else if (!projectName.matches("[a-zA-Z][a-zA-Z_0-9|-]*")) {
throw new ProjectManagerException(
"项目名称必须以字母开头,后面跟着任意数量的字母,数字, '-' 或者 '_'.");
// } else if (!projectName.matches("[a-zA-Z][a-zA-Z_0-9|-]*")) {
// throw new ProjectManagerException(
// "项目名称必须以字母开头,后面跟着任意数量的字母,数字, '-' 或者 '_'.");
}

final Project newProject;
Expand Down Expand Up @@ -629,8 +629,8 @@ public Project createProject(final String projectName, final String description,
throw new ProjectManagerException(dataMap.get("noBlankProgramDesc"));
} else if (creator == null) {
throw new ProjectManagerException(dataMap.get("noInvalidUser"));
} else if (!projectName.matches("[a-zA-Z][a-zA-Z_0-9|-]*")) {
throw new ProjectManagerException(dataMap.get("checkProgramName"));
// } else if (!projectName.matches("[a-zA-Z][a-zA-Z_0-9|-]*")) {
// throw new ProjectManagerException(dataMap.get("checkProgramName"));
}

final Project newProject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"noBlankProgramName": "项目名称不能为空.",
"noBlankProgramDesc": "项目描述不能为空.",
"noInvalidUser": "必须使用有效用户创建项目.",
"checkProgramName": "项目名称必须以字母开头,后面跟着任意数量的字母,数字, '-' 或者 '_'.",
"checkProgramName": "项目名称可以是中文.",
"hasExistProgram": "项目已经存在."
},
"com.webank.wedatasphere.schedulis.system.SystemManager": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Map<String, Object> parseMultipart(final HttpServletRequest request)
final Map<String, Object> params = new HashMap<>();
for (final FileItem item : items) {
if (item.isFormField()) {
params.put(item.getFieldName(), item.getString());
params.put(item.getFieldName(), item.getString("utf-8"));
} else {
params.put(item.getFieldName(), item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,8 @@
import com.webank.wedatasphere.schedulis.common.system.common.TransitionService;
import com.webank.wedatasphere.schedulis.common.system.entity.WebankDepartment;
import com.webank.wedatasphere.schedulis.common.system.entity.WtssUser;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

import java.io.*;
import java.security.AccessControlException;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -1348,8 +1343,8 @@ private void handleDownloadProject(final HttpServletRequest req,

final String headerKey = "Content-Disposition";
final String headerValue =
String.format("attachment; filename=\"%s\"",
projectFileHandler.getFileName());
String.format("attachment; filename=%s.zip",
java.net.URLEncoder.encode(projectName, "UTF8"));
resp.setHeader(headerKey, headerValue);
resp.setHeader("version",
Integer.toString(projectFileHandler.getVersion()));
Expand Down Expand Up @@ -3032,8 +3027,8 @@ private void handleCreate(final HttpServletRequest req, final HttpServletRespons
action = "redirect";
final String redirect = "manager?project=" + projectName;
params = new HashMap<>();
params.put("path", redirect);
} catch (final ProjectManagerException e) {
params.put("path", java.net.URLEncoder.encode(redirect, "UTF-8"));
} catch (final ProjectManagerException | UnsupportedEncodingException e) {
message = e.getMessage();
status = "error";
}
Expand Down Expand Up @@ -3238,7 +3233,9 @@ private void handleUpload(final HttpServletRequest req, final HttpServletRespons
final Map<String, Object> multipart, final Session session) throws ServletException,
IOException {
final HashMap<String, String> ret = new HashMap<>();
final String projectName = (String) multipart.get("project");
//解决项目能上传成功但是返回报错问题
final String projectName =java.net.URLEncoder.encode(((String) multipart.get("project")), "UTF-8");

ajaxHandleUpload(req, resp, ret, multipart, session);

if (ret.containsKey("error")) {
Expand Down