update
This commit is contained in:
+15
-10
@@ -168,7 +168,7 @@ Successfully uploaded: test.json
|
||||
struct put_file
|
||||
storage::GarageStorage
|
||||
end
|
||||
function (pf::put_file)(key::String, data::Union{String, Vector{UInt8}})
|
||||
function (pf::put_file)(key::String, data::Union{String, Vector{UInt8}})::String
|
||||
# Check if the key contains a slash (virtual folder character)
|
||||
if occursin('/', key)
|
||||
@warn "Upload aborted! Slashes ('/') are not allowed in keys ('$key') to prevent S3 listing issues. Use a flat naming convention instead (e.g., 'users-1002.json')."
|
||||
@@ -209,16 +209,21 @@ julia> put_file(storage, "test.json", "{\"status\": \"active\"}")
|
||||
Successfully uploaded: test.json
|
||||
```
|
||||
"""
|
||||
function put_file(storage::GarageStorage, key::String, data::Union{String, Vector{UInt8}})
|
||||
# Check if the key contains a slash (virtual folder character)
|
||||
if occursin('/', key)
|
||||
@warn "Upload aborted! Slashes ('/') are not allowed in keys ('$key') to prevent S3 listing issues. Use a flat naming convention instead (e.g., 'users-1002.json')."
|
||||
return nothing
|
||||
end
|
||||
function put_file(storage::GarageStorage, key::String, data::Union{String, Vector{UInt8}})::String
|
||||
# Check if the key contains a slash (virtual folder character)
|
||||
if occursin('/', key)
|
||||
@warn "Upload aborted! Slashes ('/') are not allowed in keys ('$key') to prevent S3 listing issues. Use a flat naming convention instead (e.g., 'users-1002.json')."
|
||||
return nothing
|
||||
end
|
||||
|
||||
# Proceed if the key is flat
|
||||
s3_put(storage.config, storage.bucket, key, data)
|
||||
println("Successfully uploaded: ", key)
|
||||
# Proceed if the key is flat
|
||||
s3_put(storage.config, storage.bucket, key, data)
|
||||
println("Successfully uploaded: ", key)
|
||||
|
||||
# file download URL
|
||||
objURL = "$(pf.storage.config.endpoint)/$(pf.storage.bucket)/$key"
|
||||
|
||||
return objURL
|
||||
end
|
||||
|
||||
""" Download an object from the Garage S3 bucket.
|
||||
|
||||
Reference in New Issue
Block a user