added back comments

This commit is contained in:
PhilReact 2025-05-24 19:15:36 +03:00
parent ca88cb1f88
commit 9e4925c8dd

View File

@ -1910,10 +1910,12 @@ public String finalizeUpload(
maxAttempts = 5; maxAttempts = 5;
} }
// Load the file // Loop until we have data
if (async) { if (async) {
// Asynchronous
arbitraryDataReader.loadAsynchronously(false, 1); arbitraryDataReader.loadAsynchronously(false, 1);
} else { } else {
// Synchronous
while (!Controller.isStopping()) { while (!Controller.isStopping()) {
attempts++; attempts++;
if (!arbitraryDataReader.isBuilding()) { if (!arbitraryDataReader.isBuilding()) {
@ -1932,12 +1934,15 @@ public String finalizeUpload(
java.nio.file.Path outputPath = arbitraryDataReader.getFilePath(); java.nio.file.Path outputPath = arbitraryDataReader.getFilePath();
if (outputPath == null) { if (outputPath == null) {
// Assume the resource doesn't exist
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.FILE_NOT_FOUND, "File not found"); throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.FILE_NOT_FOUND, "File not found");
} }
if (filepath == null || filepath.isEmpty()) { if (filepath == null || filepath.isEmpty()) {
// No file path supplied - so check if this is a single file resource
String[] files = ArrayUtils.removeElement(outputPath.toFile().list(), ".qortal"); String[] files = ArrayUtils.removeElement(outputPath.toFile().list(), ".qortal");
if (files != null && files.length == 1) { if (files != null && files.length == 1) {
// This is a single file resource
filepath = files[0]; filepath = files[0];
} else { } else {
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "filepath is required for resources containing more than one file"); throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "filepath is required for resources containing more than one file");