Skip to content

Commit

Permalink
fix offline when image not available (#18066)
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
  • Loading branch information
mherwege authored and jlaur committed Jan 8, 2025
1 parent 2a4fea2 commit ae81f39
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,19 @@ private void getSpeed() {
isp = tmpCont.getIsp();
interfaceInternalIp = tmpCont.getInterface().getInternalIp();
interfaceExternalIp = tmpCont.getInterface().getExternalIp();
resultUrl = tmpCont.getResult().getUrl();
String url = String.valueOf(resultUrl) + ".png";
logger.debug("Downloading result image from: {}", url);
RawType image = HttpUtil.downloadImage(url);
if (image != null) {
resultImage = image;
if (tmpCont.getResult().isPersisted()) {
resultUrl = tmpCont.getResult().getUrl();
String url = String.valueOf(resultUrl) + ".png";
logger.debug("Downloading result image from: {}", url);
RawType image = HttpUtil.downloadImage(url);
if (image != null) {
resultImage = image;
} else {
resultImage = UnDefType.NULL;
}
} else {
logger.debug("Result image not persisted");
resultUrl = "";
resultImage = UnDefType.NULL;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public class Result {
@SerializedName("url")
@Expose
private String url;
@SerializedName("persisted")
@Expose
private boolean persisted;

public String getId() {
return id;
Expand All @@ -279,6 +282,14 @@ public String getUrl() {
public void setUrl(String url) {
this.url = url;
}

public boolean isPersisted() {
return persisted;
}

public void setPersisted(boolean persisted) {
this.persisted = persisted;
}
}

public class Server {
Expand Down

0 comments on commit ae81f39

Please sign in to comment.