Merge branch 'dev' of github.com:halo-dev/halo into dev

pull/398/head
ruibaby 2019-11-22 11:28:56 +08:00
commit ede23329d5
2 changed files with 21 additions and 3 deletions

17
.github/workflows/gradle.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build

View File

@ -39,6 +39,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Backup service implementation.
@ -177,9 +178,9 @@ public class BackupServiceImpl implements BackupService {
@Override
public List<BackupDTO> listHaloBackups() {
try {
// Build backup dto
return Files.list(Paths.get(haloProperties.getBackupDir()))
// Build backup dto
try (Stream<Path> subPathStream = Files.list(Paths.get(haloProperties.getBackupDir()))) {
return subPathStream
.filter(backupPath -> StringUtils.startsWithIgnoreCase(backupPath.getFileName().toString(), HaloConst.HALO_BACKUP_PREFIX))
.map(this::buildBackupDto)
.sorted((leftBackup, rightBackup) -> {