mirror of https://github.com/halo-dev/halo
Replace downloadUrl into downloadLink of BackupDTO
parent
a182dc7de7
commit
53f45458b2
|
@ -9,8 +9,11 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class BackupDTO {
|
public class BackupDTO {
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
private String downloadUrl;
|
private String downloadUrl;
|
||||||
|
|
||||||
|
private String downloadLink;
|
||||||
|
|
||||||
private String filename;
|
private String filename;
|
||||||
|
|
||||||
private Long updateTime;
|
private Long updateTime;
|
||||||
|
|
|
@ -206,7 +206,6 @@ public class BackupServiceImpl implements BackupService {
|
||||||
try {
|
try {
|
||||||
// Delete backup file
|
// Delete backup file
|
||||||
Files.delete(backupPath);
|
Files.delete(backupPath);
|
||||||
|
|
||||||
} catch (NoSuchFileException e) {
|
} catch (NoSuchFileException e) {
|
||||||
throw new NotFoundException("The file " + filename + " was not found", e);
|
throw new NotFoundException("The file " + filename + " was not found", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -226,16 +225,13 @@ public class BackupServiceImpl implements BackupService {
|
||||||
String backupFileName = backupPath.getFileName().toString();
|
String backupFileName = backupPath.getFileName().toString();
|
||||||
BackupDTO backup = new BackupDTO();
|
BackupDTO backup = new BackupDTO();
|
||||||
backup.setDownloadUrl(buildDownloadUrl(backupFileName));
|
backup.setDownloadUrl(buildDownloadUrl(backupFileName));
|
||||||
|
backup.setDownloadLink(backup.getDownloadLink());
|
||||||
backup.setFilename(backupFileName);
|
backup.setFilename(backupFileName);
|
||||||
try {
|
try {
|
||||||
backup.setUpdateTime(Files.getLastModifiedTime(backupPath).toMillis());
|
backup.setUpdateTime(Files.getLastModifiedTime(backupPath).toMillis());
|
||||||
} catch (IOException e) {
|
|
||||||
throw new ServiceException("Failed to get last modified time of " + backupPath.toString(), e);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
backup.setFileSize(Files.size(backupPath));
|
backup.setFileSize(Files.size(backupPath));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ServiceException("Failed to get file size " + backupPath.toString(), e);
|
throw new ServiceException("Failed to access file " + backupPath.toString(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return backup;
|
return backup;
|
||||||
|
|
Loading…
Reference in New Issue