Skip to content

Commit

Permalink
Set content type.
Browse files Browse the repository at this point in the history
Former-commit-id: d28d7493dfc892a782c08536233c446fd9d3ebe6
  • Loading branch information
dkocher committed Apr 7, 2013
1 parent 0e17ef4 commit 746fc09
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions source/ch/cyberduck/core/cf/CFPath.java
Expand Up @@ -251,6 +251,7 @@ public AttributedList<Path> list(final AttributedList<Path> children) {
}
if(file.attributes().isDirectory()) {
file.attributes().setPlaceholder(true);
file.attributes().setVersionId("-");
if(children.contains(file.getReference())) {
continue;
}
Expand Down
4 changes: 0 additions & 4 deletions source/ch/cyberduck/core/dav/DAVPath.java
Expand Up @@ -21,7 +21,6 @@

import ch.cyberduck.core.AbstractPath;
import ch.cyberduck.core.AttributedList;
import ch.cyberduck.core.MappingMimeTypeService;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.Preferences;
import ch.cyberduck.core.StreamListener;
Expand All @@ -39,7 +38,6 @@
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpResponseException;
import org.apache.http.entity.AbstractHttpEntity;
import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.HTTP;
import org.apache.log4j.Logger;

Expand Down Expand Up @@ -392,8 +390,6 @@ private ResponseOutputStream<Void> write(final Map<String, String> headers, fina
*/
@Override
public Void call(AbstractHttpEntity entity) throws IOException {
final String type = new MappingMimeTypeService().getMime(getName());
entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, type));
getSession().getClient().put(toURL(), entity, headers);
return null;
}
Expand Down
5 changes: 5 additions & 0 deletions source/ch/cyberduck/core/http/HttpPath.java
Expand Up @@ -19,12 +19,15 @@
* dkocher@cyberduck.ch
*/

import ch.cyberduck.core.MappingMimeTypeService;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.local.Local;
import ch.cyberduck.core.threading.ActionOperationBatcher;
import ch.cyberduck.core.threading.ActionOperationBatcherFactory;
import ch.cyberduck.core.threading.NamedThreadFactory;

import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.HTTP;
import org.apache.log4j.Logger;

import java.io.IOException;
Expand Down Expand Up @@ -90,6 +93,8 @@ public long getContentLength() {
return command.getContentLength();
}
};
final String type = new MappingMimeTypeService().getMime(this.getName());
entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, type));
final FutureHttpResponse<T> target = new FutureHttpResponse<T>() {
@Override
public void run() {
Expand Down
5 changes: 1 addition & 4 deletions source/ch/cyberduck/core/s3/S3Path.java
Expand Up @@ -33,9 +33,7 @@

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpHeaders;
import org.apache.http.entity.AbstractHttpEntity;
import org.apache.http.message.BasicHeader;
import org.apache.log4j.Logger;
import org.jets3t.service.ServiceException;
import org.jets3t.service.StorageObjectsChunk;
Expand Down Expand Up @@ -820,9 +818,7 @@ private ResponseOutputStream<StorageObject> write(final StorageObject part, fina
DelayedHttpEntityCallable<StorageObject> command = new DelayedHttpEntityCallable<StorageObject>() {
@Override
public StorageObject call(AbstractHttpEntity entity) throws IOException {
final String type = new MappingMimeTypeService().getMime(getName());
try {
entity.setContentType(new BasicHeader(HttpHeaders.CONTENT_TYPE, type));
getSession().getClient().putObjectWithRequestEntityImpl(getContainerName(), part, entity, requestParams);
}
catch(ServiceException e) {
Expand Down Expand Up @@ -946,6 +942,7 @@ protected AttributedList<Path> listObjects(String bucket, String prefix, String
if(object.isDirectoryPlaceholder()) {
p.attributes().setType(DIRECTORY_TYPE);
p.attributes().setPlaceholder(true);
p.attributes().setDuplicate(true);
}
else if(0 == object.getContentLength()) {
if("application/x-directory".equals(p.getDetails().getContentType())) {
Expand Down

0 comments on commit 746fc09

Please sign in to comment.