Don't treat HashMismatchException as a fatal error when restoring

because may just be a corrupted file
This commit is contained in:
Torsten Grote 2024-11-19 14:19:21 -03:00
parent 32aff32c73
commit 417531ff49
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF

View file

@ -19,6 +19,7 @@ import com.stevesoltys.seedvault.header.HeaderReader
import com.stevesoltys.seedvault.header.MAX_SEGMENT_LENGTH import com.stevesoltys.seedvault.header.MAX_SEGMENT_LENGTH
import com.stevesoltys.seedvault.header.UnsupportedVersionException import com.stevesoltys.seedvault.header.UnsupportedVersionException
import com.stevesoltys.seedvault.header.getADForFull import com.stevesoltys.seedvault.header.getADForFull
import com.stevesoltys.seedvault.repo.HashMismatchException
import com.stevesoltys.seedvault.repo.Loader import com.stevesoltys.seedvault.repo.Loader
import libcore.io.IoUtils.closeQuietly import libcore.io.IoUtils.closeQuietly
import org.calyxos.seedvault.core.backends.AppBackupFileType.Blob import org.calyxos.seedvault.core.backends.AppBackupFileType.Blob
@ -146,6 +147,9 @@ internal class FullRestore(
} catch (e: IOException) { } catch (e: IOException) {
Log.w(TAG, "Error getting input stream for $packageName", e) Log.w(TAG, "Error getting input stream for $packageName", e)
return TRANSPORT_PACKAGE_REJECTED return TRANSPORT_PACKAGE_REJECTED
} catch (e: HashMismatchException) {
Log.w(TAG, "Hash mismatch for $packageName", e)
return TRANSPORT_PACKAGE_REJECTED
} catch (e: SecurityException) { } catch (e: SecurityException) {
Log.e(TAG, "Security Exception while getting input stream for $packageName", e) Log.e(TAG, "Security Exception while getting input stream for $packageName", e)
return TRANSPORT_ERROR return TRANSPORT_ERROR