优化上传文件的文件名

hdrplus
Matthew 11 months ago
parent fad7f20ed1
commit 7a2a9a1f6d

@ -496,7 +496,7 @@ public class AppMaster {
SysApi.reboot(mService.getApplicationContext());
} else if (TextUtils.equals(cmd, CMD_UPLOAD_LOGS)) {
String url = jsonObject.optString("url", null);
mService.logger.warning("Recv Upload Log" + url);
mService.logger.warning("Recv Upload Log " + url);
int noSpecData = jsonObject.optInt("noSpecData", 0);
uploadLogs(url, noSpecData == 0);
// uploadMasterLogs(url);
@ -1074,7 +1074,13 @@ public class AppMaster {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date dt = new Date(ts);
final String fileName = mCmdid + "_" + format.format(dt) + ".zip";
String fileName = "";
if (paths.size() != 1) {
fileName = mCmdid + "_" + format.format(dt) + ".zip";
} else {
File file = new File(paths.get(0));
fileName = mCmdid + "_" + format.format(dt) + "_" + file.getName() + ".zip";
}
final File file = File.createTempFile(fileName, null, new File(appDir));
if (file == null) {
return;

Loading…
Cancel
Save