(converter) Bugfix: Don't try to Path.of() on optional field

This commit is contained in:
Viktor Lofgren 2023-09-21 13:27:09 +02:00
parent 75f8ae2815
commit ad660cf420

View File

@ -220,8 +220,6 @@ public class ConverterMain {
var request = gson.fromJson(msg.payload(), nu.marginalia.mqapi.converting.ConvertRequest.class); var request = gson.fromJson(msg.payload(), nu.marginalia.mqapi.converting.ConvertRequest.class);
var filePath = Path.of(request.inputSource);
return switch(request.action) { return switch(request.action) {
case ConvertCrawlData -> { case ConvertCrawlData -> {
var crawlData = fileStorageService.getStorage(request.crawlStorage); var crawlData = fileStorageService.getStorage(request.crawlStorage);
@ -236,7 +234,7 @@ public class ConverterMain {
case SideloadEncyclopedia -> { case SideloadEncyclopedia -> {
var processData = fileStorageService.getStorage(request.processedDataStorage); var processData = fileStorageService.getStorage(request.processedDataStorage);
yield new SideloadAction(sideloadSourceFactory.sideloadEncyclopediaMarginaliaNu(filePath), yield new SideloadAction(sideloadSourceFactory.sideloadEncyclopediaMarginaliaNu(Path.of(request.inputSource)),
processData.asPath(), processData.asPath(),
msg, inbox); msg, inbox);
} }
@ -244,14 +242,14 @@ public class ConverterMain {
var processData = fileStorageService.getStorage(request.processedDataStorage); var processData = fileStorageService.getStorage(request.processedDataStorage);
yield new SideloadAction( yield new SideloadAction(
sideloadSourceFactory.sideloadDirtree(filePath), sideloadSourceFactory.sideloadDirtree(Path.of(request.inputSource)),
processData.asPath(), processData.asPath(),
msg, inbox); msg, inbox);
} }
case SideloadStackexchange -> { case SideloadStackexchange -> {
var processData = fileStorageService.getStorage(request.processedDataStorage); var processData = fileStorageService.getStorage(request.processedDataStorage);
yield new SideloadAction(sideloadSourceFactory.sideloadStackexchange(filePath), yield new SideloadAction(sideloadSourceFactory.sideloadStackexchange(Path.of(request.inputSource)),
processData.asPath(), processData.asPath(),
msg, inbox); msg, inbox);
} }