Skip to content

Commit

Permalink
Fix container URLs. #2875.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jan 12, 2009
1 parent 80bc642 commit 2634da7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion source/ch/cyberduck/core/cf/CFPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public Session getSession() {
}

public String getKey() {
if(this.isContainer()) {
return null;
}
return this.getName();
}

Expand Down Expand Up @@ -474,7 +477,9 @@ public String toHttpURL() {
}
StringBuffer b = new StringBuffer();
b.append(distribution.getUrl());
b.append(this.encode(this.getKey()));
if(!this.isContainer()) {
b.append(this.encode(this.getKey()));
}
return b.toString();
}
}
8 changes: 4 additions & 4 deletions source/ch/cyberduck/core/s3/S3Path.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public void upload(BandwidthThrottle throttle, final StreamListener listener, fi
*/
public String getKey() {
if(this.isContainer()) {
return this.getContainerName();
return null;
}
if(this.getAbsolute().startsWith(Path.DELIMITER + this.getContainerName())) {
return this.getAbsolute().substring(this.getContainerName().length() + 2);
Expand Down Expand Up @@ -823,13 +823,13 @@ public String toURL() {
log.error(e.getMessage());
}
}
final String key = this.isContainer() ? "" : this.encode(this.getKey());
if(RestS3Service.isBucketNameValidDNSName(this.getContainerName())) {
return Protocol.S3.getScheme() + "://"
+ RestS3Service.generateS3HostnameForBucket(this.getContainerName()) + this.encode(this.getKey());
+ RestS3Service.generateS3HostnameForBucket(this.getContainerName()) + key;
}
else {
return this.getSession().getHost().toURL() + Path.DELIMITER + this.getContainerName()
+ this.encode(this.getKey());
return this.getSession().getHost().toURL() + Path.DELIMITER + this.getContainerName() + key;
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/ch/cyberduck/ui/cocoa/CDInfoController.java
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ public void cleanup() {

final CloudPath file = ((CloudPath) files.get(0));
// Concatenate URLs
final String key = file.encode(file.getKey());
final String key = file.isContainer() ? "" : file.encode(file.getKey());
if(numberOfFiles() > 1) {
distributionUrlField.setStringValue("(" + NSBundle.localizedString("Multiple files", "") + ")");
distributionCnameUrlField.setStringValue("(" + NSBundle.localizedString("Multiple files", "") + ")");
Expand Down

0 comments on commit 2634da7

Please sign in to comment.