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
|
||||
public class BackupDTO {
|
||||
|
||||
@Deprecated
|
||||
private String downloadUrl;
|
||||
|
||||
private String downloadLink;
|
||||
|
||||
private String filename;
|
||||
|
||||
private Long updateTime;
|
||||
|
|
|
@ -206,7 +206,6 @@ public class BackupServiceImpl implements BackupService {
|
|||
try {
|
||||
// Delete backup file
|
||||
Files.delete(backupPath);
|
||||
|
||||
} catch (NoSuchFileException e) {
|
||||
throw new NotFoundException("The file " + filename + " was not found", e);
|
||||
} catch (IOException e) {
|
||||
|
@ -226,16 +225,13 @@ public class BackupServiceImpl implements BackupService {
|
|||
String backupFileName = backupPath.getFileName().toString();
|
||||
BackupDTO backup = new BackupDTO();
|
||||
backup.setDownloadUrl(buildDownloadUrl(backupFileName));
|
||||
backup.setDownloadLink(backup.getDownloadLink());
|
||||
backup.setFilename(backupFileName);
|
||||
try {
|
||||
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));
|
||||
} 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;
|
||||
|
|
Loading…
Reference in New Issue