diff --git a/NetworkReconnection/entry/src/main/ets/pages/RCPReconnection.ets b/NetworkReconnection/entry/src/main/ets/pages/RCPReconnection.ets index 75900d2a4691c6e9965984e88ee2fcc8cf1b77e2..4d1adb63e6c7bc5fdc117ce32f661b30d64f6012 100644 --- a/NetworkReconnection/entry/src/main/ets/pages/RCPReconnection.ets +++ b/NetworkReconnection/entry/src/main/ets/pages/RCPReconnection.ets @@ -90,11 +90,9 @@ export struct RCPReconnection { createRCPSession(): rcp.Session { const customHttpEventsHandler: rcp.HttpEventsHandler = { onDownloadProgress: (totalSize: number, transferredSize: number) => { - if (this.contentLength === -1) { - this.contentLength = totalSize; - } + this.contentLength = totalSize; this.downloadSize = transferredSize; - this.process = Math.floor(this.downloadSize / this.contentLength * 100); + this.process = this.contentLength === 0 ? 0 : Math.floor(this.downloadSize / this.contentLength * 100); }, onDataEnd: () => {