Restore timestamp instead of tier during manual registration remote backup restore flow.

This commit is contained in:
Cody Henthorne
2025-07-02 11:24:36 -04:00
committed by GitHub
parent ec8bb17bff
commit 437b1a3d98
15 changed files with 235 additions and 132 deletions

View File

@@ -200,8 +200,7 @@ public class SignalServiceMessageReceiver {
socket.retrieveBackup(cdnNumber, headers, cdnPath, destination, 1_000_000_000L, listener);
}
@Nullable
public ZonedDateTime getCdnLastModifiedTime(int cdnNumber, Map<String, String> headers, String cdnPath) throws MissingConfigurationException, IOException {
public @Nonnull ZonedDateTime getCdnLastModifiedTime(int cdnNumber, Map<String, String> headers, String cdnPath) throws MissingConfigurationException, IOException {
return socket.getCdnLastModifiedTime(cdnNumber, headers, cdnPath);
}

View File

@@ -677,8 +677,7 @@ public class PushServiceSocket {
}
}
@Nullable
public ZonedDateTime getCdnLastModifiedTime(int cdnNumber, Map<String, String> headers, String path) throws MissingConfigurationException, PushNetworkException, NonSuccessfulResponseCodeException {
public @Nonnull ZonedDateTime getCdnLastModifiedTime(int cdnNumber, Map<String, String> headers, String path) throws MissingConfigurationException, PushNetworkException, NonSuccessfulResponseCodeException, MalformedResponseException {
ConnectionHolder[] cdnNumberClients = cdnClientsMap.get(cdnNumber);
if (cdnNumberClients == null) {
throw new MissingConfigurationException("Attempted to download from unsupported CDN number: " + cdnNumber + ", Our configuration supports: " + cdnClientsMap.keySet());
@@ -690,7 +689,7 @@ public class PushServiceSocket {
.readTimeout(soTimeoutMillis, TimeUnit.MILLISECONDS)
.build();
Request.Builder request = new Request.Builder().url(connectionHolder.getUrl() + "/" + path).get();
Request.Builder request = new Request.Builder().url(connectionHolder.getUrl() + "/" + path).head();
if (connectionHolder.getHostHeader().isPresent()) {
request.addHeader("Host", connectionHolder.getHostHeader().get());
@@ -710,7 +709,7 @@ public class PushServiceSocket {
if (response.isSuccessful()) {
String lastModified = response.header("Last-Modified");
if (lastModified == null) {
return null;
throw new MalformedResponseException("No Last-Modified header in response");
}
return ZonedDateTime.parse(lastModified, DateTimeFormatter.RFC_1123_DATE_TIME);
} else {