mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 21:31:36 +02:00
Sanitise s3 info and fix for s3
This commit is contained in:
committed by
Michael Mazour
parent
9936fbe3c9
commit
52e5d2921f
@@ -29,7 +29,9 @@ public class Config implements JSONSource {
|
||||
config.apiBaseURL,
|
||||
config.postbackURL,
|
||||
config.serviceName,
|
||||
Oauth2.asSanitised(config.oauth2)
|
||||
Oauth2.asSanitised(config.oauth2),
|
||||
SwapStoreConfig.sanitisedCopy(config.swapStore),
|
||||
config.swapJob
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,14 +58,18 @@ public class Config implements JSONSource {
|
||||
fromJSON(new Gson().fromJson(reader, JsonElement.class));
|
||||
}
|
||||
|
||||
public Config(int port,
|
||||
String rootGitDirectory,
|
||||
String username,
|
||||
String password,
|
||||
String apiBaseURL,
|
||||
String postbackURL,
|
||||
String serviceName,
|
||||
Oauth2 oauth2) {
|
||||
public Config(
|
||||
int port,
|
||||
String rootGitDirectory,
|
||||
String username,
|
||||
String password,
|
||||
String apiBaseURL,
|
||||
String postbackURL,
|
||||
String serviceName,
|
||||
Oauth2 oauth2,
|
||||
SwapStoreConfig swapStore,
|
||||
SwapJobConfig swapJob
|
||||
) {
|
||||
this.port = port;
|
||||
this.rootGitDirectory = rootGitDirectory;
|
||||
this.username = username;
|
||||
@@ -72,6 +78,8 @@ public class Config implements JSONSource {
|
||||
this.postbackURL = postbackURL;
|
||||
this.serviceName = serviceName;
|
||||
this.oauth2 = oauth2;
|
||||
this.swapStore = swapStore;
|
||||
this.swapJob = swapJob;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -153,6 +153,7 @@ public class SwapJobImpl implements SwapJob {
|
||||
projName,
|
||||
swapStore.openDownloadStream(projName)
|
||||
);
|
||||
swapStore.remove(projName);
|
||||
dbStore.setLastAccessedTime(
|
||||
projName,
|
||||
Timestamp.valueOf(LocalDateTime.now())
|
||||
|
||||
@@ -60,4 +60,17 @@ public class SwapStoreConfig {
|
||||
return s3BucketName;
|
||||
}
|
||||
|
||||
public SwapStoreConfig sanitisedCopy() {
|
||||
return new SwapStoreConfig(
|
||||
type,
|
||||
awsAccessKey == null ? null : "<awsAccessKey>",
|
||||
awsSecret == null ? null : "<awsSecret>",
|
||||
s3BucketName
|
||||
);
|
||||
}
|
||||
|
||||
public static SwapStoreConfig sanitisedCopy(SwapStoreConfig swapStore) {
|
||||
return swapStore == null ? null : swapStore.sanitisedCopy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,14 +62,20 @@ public class WLRepositoryResolver
|
||||
/* Such as FailedConnectionException */
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
Log.warn("Runtime exception when trying to open repo", e);
|
||||
Log.warn(
|
||||
"Runtime exception when trying to open repo: " + projName,
|
||||
e
|
||||
);
|
||||
throw new ServiceMayNotContinueException(e);
|
||||
} catch (ForbiddenException e) {
|
||||
throw new ServiceNotAuthorizedException();
|
||||
} catch (GitUserException e) {
|
||||
throw new ServiceMayNotContinueException(e.getMessage(), e);
|
||||
} catch (IOException e) {
|
||||
Log.warn("IOException when trying to open repo", e);
|
||||
Log.warn(
|
||||
"IOException when trying to open repo: " + projName,
|
||||
e
|
||||
);
|
||||
throw new ServiceMayNotContinueException("Internal server error.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user