diff --git a/settings.yml b/settings.yml index 5d6533c..59ed31d 100644 --- a/settings.yml +++ b/settings.yml @@ -2,6 +2,7 @@ enableCors: true corsOrigins: "*" # If using attaching IAM Role to instance leave accessKey and secretKey empty +# You can also leave accessKey and secretKey empty if you prefer to use credentials from ~/.aws/credentials s3Fs: bucket: pathPrefix: diff --git a/src/main/java/com/takipi/oss/storage/fs/s3/S3Filesystem.java b/src/main/java/com/takipi/oss/storage/fs/s3/S3Filesystem.java index 86e77ec..1fb4b86 100644 --- a/src/main/java/com/takipi/oss/storage/fs/s3/S3Filesystem.java +++ b/src/main/java/com/takipi/oss/storage/fs/s3/S3Filesystem.java @@ -12,7 +12,7 @@ import com.amazonaws.services.s3.model.S3ObjectSummary; import com.takipi.oss.storage.data.simple.SimpleSearchResponse; import com.takipi.oss.storage.fs.BaseRecord; -import com.takipi.oss.storage.fs.SimplePathRecord; +import com.takipi.oss.storage.fs.Record; import com.takipi.oss.storage.fs.api.Filesystem; import com.takipi.oss.storage.fs.api.SearchRequest; import com.takipi.oss.storage.fs.api.SearchResult; @@ -96,7 +96,11 @@ public boolean healthy() { @Override public BaseRecord pathToRecord(String path) { - return SimplePathRecord.newRecord(path); + String[] strs = path.trim().split(File.separator,3); + if (strs.length == 3) + return Record.newRecord(strs[0], strs[1], strs[2]); + else + return null; } private String keyOf(T record) {