[ring] Fix download of videos (#20166)

* Fix download of videos

Signed-off-by: Paul Smedley <paul@smedley.id.au>
This commit is contained in:
Paul Smedley
2026-01-31 10:12:52 +01:00
committed by GitHub
parent 0ef60aba4f
commit 3772db0467
2 changed files with 5 additions and 4 deletions
@@ -300,10 +300,9 @@ public class RestClient {
JsonObject obj = JsonParser.parseString(jsonResult).getAsJsonObject();
if (obj.get("url").getAsString().startsWith("http")) {
URL url = new URI(obj.get("url").getAsString()).toURL();
InputStream in = url.openStream();
Files.copy(in, Paths.get(fullfilepath), StandardCopyOption.REPLACE_EXISTING);
in.close();
logger.info("fullfilepath.length() = {}", fullfilepath.length());
try (InputStream in = url.openStream()) {
Files.copy(in, Paths.get(fullfilepath), StandardCopyOption.REPLACE_EXISTING);
}
if (!fullfilepath.isEmpty()) {
urlFound = true;
break;
@@ -45,6 +45,7 @@ import org.openhab.binding.ring.internal.discovery.RingDiscoveryService;
import org.openhab.binding.ring.internal.errors.AuthenticationException;
import org.openhab.binding.ring.internal.utils.RingUtils;
import org.openhab.core.OpenHAB;
import org.openhab.core.common.ThreadPoolManager;
import org.openhab.core.config.core.Configuration;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.StringType;
@@ -133,6 +134,7 @@ public class AccountHandler extends BaseBridgeHandler implements RingAccount {
this.registry = new RingDeviceRegistry();
this.restClient = new RestClient(httpClient);
this.servlet = ringVideoServlet;
this.videoExecutorService = ThreadPoolManager.getScheduledPool("ring");
}
@Override