diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt index 2cdc8fd..ed2c743 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt @@ -17,7 +17,7 @@ internal class S3Directory( override suspend fun create(filename: String, ignoreIfExists: Boolean) { if (!ignoreIfExists) { - throw IllegalArgumentException("could not check if file exists") + TODO("could not check if file exists") } } diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt index 14f18bd..3ab1a68 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt @@ -17,8 +17,8 @@ public fun s3Bucket(client: S3Client, bucket: String): Directory = internal fun splitPathIntoBucketAndPath(path: Path): Pair { val bucket = path.getName(0) - val recent = path.relativize(bucket) - return Pair(bucket.toString(), recent) + val filePath = path.relativize(bucket) + return Pair(bucket.toString(), filePath) } internal class S3Root(private val client: S3Client) : Directory { @@ -35,21 +35,21 @@ internal class S3Root(private val client: S3Client) : Directory { } override suspend fun getSubdir(path: Path): Directory = try { - val (bucketName, recentPath) = splitPathIntoBucketAndPath(path) + val (bucketName, filePath) = splitPathIntoBucketAndPath(path) client.headBucket { bucket = bucketName } - S3Directory(client, bucketName, recentPath) + S3Directory(client, bucketName, filePath) } catch (ex: Exception) { throw AccessDeniedException(path.toFile(), reason = ex.message) } override suspend fun createSubdir(dirname: String, ignoreIfExists: Boolean): Directory = try { - val (bucketName, recentPath) = splitPathIntoBucketAndPath(Path(dirname)) + val (bucketName, filePath) = splitPathIntoBucketAndPath(Path(dirname)) client.createBucket { bucket = bucketName } - S3Directory(client, bucketName, recentPath) + S3Directory(client, bucketName, filePath) } catch (ex: Exception) { throw AccessDeniedException(File(dirname), reason = ex.message) }