Fix download rename with dashes for #721

This commit is contained in:
crschnick
2025-11-20 16:21:46 +00:00
parent 2fda1fc8c1
commit 2f7bc51feb
@@ -35,18 +35,17 @@ public class AppDownloads {
throw new IOException(new String(response.body(), StandardCharsets.UTF_8));
}
var downloadFile = AppSystemInfo.ofCurrent().getTemp().resolve(release.getFile());
// Fix file name to not be included in temp dir clean
var fixedFile = Path.of(downloadFile.toString().replaceAll("-", "_"));
Files.write(fixedFile, response.body());
// Fix file name to not have dashes to not be included in temp dir clean
var downloadFile = AppSystemInfo.ofCurrent().getTemp().resolve(release.getFile().replaceAll("-", "_"));
Files.write(downloadFile, response.body());
TrackEvent.withInfo("Downloaded asset")
.tag("version", version)
.tag("url", release.getUrl())
.tag("size", FileUtils.byteCountToDisplaySize(response.body().length))
.tag("target", fixedFile)
.tag("target", downloadFile)
.handle();
return fixedFile;
return downloadFile;
} catch (IOException ex) {
// All sorts of things can go wrong when downloading, this is expected
ErrorEventFactory.expected(ex);