Issue With Moving Files With Special Characters To Archive Cloud Service (Doc ID 2253132.1)

Last updated on APRIL 10, 2017

Applies to:

Oracle Storage Cloud Service - Version 13.2 and later
Information in this document applies to any platform.

Goal

If the object key is URL encoded once it fails, but if it encoded twice it works for both PUT/GET.

For e.g.
When using the java sdk version 13.1.1. And code snippet is below

import java.net.URLEncoder;
String ENCODING = StandardCharsets.UTF_8.displayName();

String key = "my'file.txt";
String onceEncodedKey = URLEncoder.encode(key, ENCODING);
String twiceEncodedKey = URLEncoder.encode(onceEncodedKey, ENCODING);

Api call:
try (InputStream inputSteam = new FileInputStream(file)) {
cloudStorage.storeObject(bucketName, onceEncodedKey, "application/octet-stream", inputStream);
}
Result:
Exception in thread "main" oracle.cloud.storage.exception.SystemException: An unexpected response was returned from the server: BAD_REQUEST <html><body>Object/Container name contains forbidden chars from '"'<></body></html>
at oracle.cloud.storage.internal.CloudStorageImpl.storeObject(CloudStorageImpl.java:655)
at oracle.cloud.storage.internal.CloudStorageImpl.storeObject(CloudStorageImpl.java:620)

Api call:
try (InputStream inputSteam = new FileInputStream(file)) {
cloudStorage.storeObject(bucketName, twiceEncodedKey, "application/octet-stream", inputStream);
}
Result:
The operation is successful

The original file name my'file.txt"
This is what is looks like encoded once my%27file.txt -> fails (surprisingly this is what the object listing api returns, but it fails if you try to do a get with that name)
This is what it looks like encoded twice my%2527file.txt -> works (stored in the target as exactly the same name as expected)

 

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms