Merge pull request #610 from andrewgaul/filesystem-overwrite-check

Do not check for equality on overwrites
This commit is contained in:
Adrian Cole 2012-05-07 16:27:11 -07:00
commit f836ff5258
1 changed files with 1 additions and 5 deletions

View File

@ -199,15 +199,11 @@ public class FilesystemStorageStrategyImpl implements FilesystemStorageStrategy
filesystemContainerNameValidator.validate(container); filesystemContainerNameValidator.validate(container);
filesystemBlobKeyValidator.validate(blobKey); filesystemBlobKeyValidator.validate(blobKey);
File outputFile = getFileForBlobKey(container, blobKey); File outputFile = getFileForBlobKey(container, blobKey);
if (payload.getRawContent().equals(outputFile)){
// we shouldn't re-copy the same contents
return;
}
FileOutputStream output = null; FileOutputStream output = null;
try { try {
Files.createParentDirs(outputFile); Files.createParentDirs(outputFile);
if (payload.getRawContent() instanceof File) if (payload.getRawContent() instanceof File)
Files.copy(File.class.cast(payload.getRawContent()), outputFile); Files.copy((File) payload.getRawContent(), outputFile);
else { else {
output = new FileOutputStream(outputFile); output = new FileOutputStream(outputFile);
payload.writeTo(output); payload.writeTo(output);