Skip to content

Commit

Permalink
Fix #5364.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Oct 26, 2010
1 parent 6964f90 commit f438f5c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/ch/cyberduck/core/Preferences.java
Expand Up @@ -534,6 +534,11 @@ protected void setDefaults() {
final int MONTH = 60 * 60 * 24 * 30; //30 days in seconds
defaults.put("s3.cache.seconds", String.valueOf(MONTH));

/**
* Default metadata for uploads. Format must be "key1=value1 key2=value2"
*/
defaults.put("s3.metadata.default", "");

defaults.put("webdav.followRedirects", String.valueOf(true));

defaults.put("cf.authentication.host", "auth.api.rackspacecloud.com");
Expand Down
24 changes: 24 additions & 0 deletions source/ch/cyberduck/core/s3/S3Path.java
Expand Up @@ -540,7 +540,31 @@ else if(acl.equals(this.getSession().getPublicAcl(this.getContainerName(), true,
else {
object.setAcl(this.convert(acl));
}
// Storage class
object.setStorageClass(Preferences.instance().getProperty("s3.storage.class"));
// Default metadata for new files
for(String m : Preferences.instance().getProperty("s3.metadata.default").split("\\p{javaWhitespace}+")) {
if(StringUtils.isBlank(m)) {
log.warn("Invalid header " + m);
continue;
}
if(!m.contains("=")) {
log.warn("Invalid header " + m);
continue;
}
int split = m.indexOf('=');
String name = m.substring(0, split);
if(StringUtils.isBlank(name)) {
log.warn("Missing key in " + m);
continue;
}
String value = m.substring(split + 1);
if(StringUtils.isEmpty(value)) {
log.warn("Missing value in " + m);
continue;
}
object.addMetadata(name, value);
}

this.getSession().message(MessageFormat.format(Locale.localizedString("Uploading {0}", "Status"),
this.getName()));
Expand Down

0 comments on commit f438f5c

Please sign in to comment.