mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 10:11:37 +03:00
parent
4b3e4ae15e
commit
a3dc50fe1e
@ -224,7 +224,7 @@ type Enso_File
|
||||
asset = Existing_Enso_Asset.get_asset_reference_for self
|
||||
response = case asset.asset_type of
|
||||
Enso_Asset_Type.File ->
|
||||
HTTP.fetch asset.get_download_url HTTP_Method.Get
|
||||
Utils.http_request HTTP_Method.Get (asset.internal_uri + "/contents")
|
||||
Enso_Asset_Type.Data_Link ->
|
||||
Runtime.assert (open_options.contains Data_Link_Access.No_Follow)
|
||||
Utils.http_request HTTP_Method.Get asset.internal_uri
|
||||
|
@ -66,13 +66,6 @@ type Existing_Enso_Asset
|
||||
Panic.throw (Illegal_Argument.Error "`get_file_description` can only be called on File assets.")
|
||||
Utils.http_request_as_json HTTP_Method.Get self.internal_uri
|
||||
|
||||
## PRIVATE
|
||||
The returned URL may be valid only for a very short time, so it should not be
|
||||
stored anywhere.
|
||||
get_download_url self -> Text =
|
||||
presigned_url = self.get_file_description |> get_required_field "url" expected_type=Text
|
||||
presigned_url
|
||||
|
||||
## PRIVATE
|
||||
Fetches the basic information about an existing file from the Cloud.
|
||||
It will fail if the file does not exist.
|
||||
|
@ -57,11 +57,11 @@ class EnsoSecretReader {
|
||||
}
|
||||
|
||||
int status = response.statusCode();
|
||||
if (status == 401 || status == 403 || status >= 500) {
|
||||
if (status == 401 || status >= 500) {
|
||||
if (retryCount < 0) {
|
||||
String kind = status >= 500 ? "server" : "authentication";
|
||||
throw new IllegalArgumentException(
|
||||
"Unable to read secret - numerous " + kind + " failures.");
|
||||
"Unable to read secret - numerous " + kind + " failures (status code " + status + ").");
|
||||
} else {
|
||||
// We forcibly refresh the access token and try again.
|
||||
AuthenticationProvider.getAuthenticationService().force_refresh();
|
||||
|
@ -40,7 +40,6 @@ public class CloudRoot extends HandlerWithTokenAuth {
|
||||
boolean isValidButExpired = token.equals("TEST-EXPIRED-TOKEN-beef");
|
||||
if (isValidButExpired) {
|
||||
expiredTokensCounter.registerExpiredTokenFailure();
|
||||
return 403;
|
||||
}
|
||||
|
||||
return 401;
|
||||
|
Loading…
Reference in New Issue
Block a user