fix: use dirStream.toList() instead of method reference cast in existsIgnoreCase
Build & Deploy / build-and-deploy (push) Successful in 40s

Iterable<Path> cast on dirStream::iterator method reference fails
in some Java environments. Stream.toList() (Java 16+) is cleaner
and guaranteed to compile.
This commit is contained in:
David Alvarez
2026-06-08 12:39:08 +02:00
parent 149d6d6c1a
commit 9a5ed5bc03
@@ -644,13 +644,12 @@ public class UploadResource {
for (int i = 0; i < parts.length; i++) { for (int i = 0; i < parts.length; i++) {
String part = parts[i]; String part = parts[i];
if (part.isEmpty()) { if (part.isEmpty()) {
// Trailing separator means directory — check if current is a dir
if (i == parts.length - 1) return Files.isDirectory(current); if (i == parts.length - 1) return Files.isDirectory(current);
continue; continue;
} }
Path found = null; Path found = null;
try (var dirStream = Files.list(current)) { try (var dirStream = Files.list(current)) {
for (Path entry : (Iterable<Path>) dirStream::iterator) { for (Path entry : dirStream.toList()) {
if (entry.getFileName().toString().equalsIgnoreCase(part)) { if (entry.getFileName().toString().equalsIgnoreCase(part)) {
found = entry; found = entry;
break; break;