diff --git a/source/ch/cyberduck/core/Preferences.java b/source/ch/cyberduck/core/Preferences.java index 6f966ad5401..d8b629fcf08 100644 --- a/source/ch/cyberduck/core/Preferences.java +++ b/source/ch/cyberduck/core/Preferences.java @@ -521,6 +521,7 @@ protected void setDefaults() { * If set calculate MD5 sum of uploaded file and set metadata header Content-MD5 */ defaults.put("s3.upload.metadata.md5", String.valueOf(false)); + defaults.put("cf.upload.metadata.md5", String.valueOf(false)); /** * A prefix to apply to log file names */ diff --git a/source/ch/cyberduck/core/cf/CFPath.java b/source/ch/cyberduck/core/cf/CFPath.java index aea4050c0dc..cd904f7bb12 100644 --- a/source/ch/cyberduck/core/cf/CFPath.java +++ b/source/ch/cyberduck/core/cf/CFPath.java @@ -273,18 +273,27 @@ protected void upload(final BandwidthThrottle throttle, final StreamListener lis // No Content-Range support final Status status = this.status(); status.setResume(false); + String md5sum = null; + if(Preferences.instance().getBoolean("cf.upload.metadata.md5")) { + this.getSession().message(MessageFormat.format(Locale.localizedString("Compute MD5 hash of {0}", "Status"), + this.getName())); + md5sum = this.getLocal().attributes().getChecksum(); + } this.getSession().message(MessageFormat.format(Locale.localizedString("Uploading {0}", "Status"), this.getName())); final InputStream in; MessageDigest digest = null; - try { - digest = MessageDigest.getInstance("MD5"); - } - catch(NoSuchAlgorithmException e) { - log.error("MD5 calculation disabled:" + e.getMessage()); + if(!Preferences.instance().getBoolean("cf.upload.metadata.md5")) { + try { + digest = MessageDigest.getInstance("MD5"); + } + catch(NoSuchAlgorithmException e) { + log.error("MD5 calculation disabled:" + e.getMessage()); + } } if(null == digest) { + log.warn("MD5 calculation disabled"); in = this.getLocal().getInputStream(); } else { @@ -303,7 +312,7 @@ public void writeRequest(OutputStream out) throws IOException { CFPath.this.upload(out, in, throttle, listener); } }, - metadata, null + metadata, md5sum ); } finally {