Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
version: "3.7"

# YAML Anchors

x-deployment-env: &deployment-env
ENV: ${ENV:-development}
SG_ENV: ${SG_ENV:-development}
Expand Down
6 changes: 3 additions & 3 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ shards:

hot_topic:
git: https://github.com/jgaskins/hot_topic.git
version: 0.1.0+git.commit.3c901e77b6e000930398738260a2944b6f5785dc
version: 0.1.0+git.commit.4eafc046ed4d98bbab7a4534da57e163ea16b6c6

http-params-serializable:
git: https://github.com/place-labs/http-params-serializable.git
Expand Down Expand Up @@ -203,7 +203,7 @@ shards:

placeos-driver:
git: https://github.com/placeos/driver.git
version: 7.10.2
version: 7.11.1

placeos-frontend-loader:
git: https://github.com/placeos/frontend-loader.git
Expand All @@ -215,7 +215,7 @@ shards:

placeos-models:
git: https://github.com/placeos/models.git
version: 9.67.0
version: 9.69.0

placeos-resource:
git: https://github.com/place-labs/resource.git
Expand Down
14 changes: 9 additions & 5 deletions spec/controllers/uploads_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ module PlaceOS::Api
it "post should return the pre-signed signature" do
Model::Generator.storage.save!
params = {
"file_name" => "some_file_name.jpg",
"file_size" => "500",
"file_id" => "some_file_md5_hash",
"file_mime" => "image/jpeg",
"file_name" => "some_file_name.jpg",
"file_size" => "500",
"file_id" => "some_file_md5_hash",
"file_mime" => "image/jpeg",
"cache_etag" => "12345",
}

resp = client.post(Uploads.base_route,
Expand All @@ -167,7 +168,10 @@ module PlaceOS::Api
sig = info["signature"].as_h
sig["verb"].as_s.should eq("PUT")
sig["url"].as_s.should_not be_nil
Model::Upload.find?(info["upload_id"].as_s).should_not be_nil
model = Model::Upload.find?(info["upload_id"].as_s)
model.should_not be_nil
raise "will never raise" unless model
model.cache_etag.should eq "12345"
end

it "post should return the pre-signed signature for multi-part" do
Expand Down
6 changes: 4 additions & 2 deletions src/placeos-rest-api/controllers/uploads.cr
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ module PlaceOS::Api

record UploadInfo, file_name : String, file_size : String, file_id : String, file_mime : String? = nil,
file_path : String? = nil, permissions : ::PlaceOS::Model::Upload::Permissions = ::PlaceOS::Model::Upload::Permissions::None,
public : Bool = true, expires : Int32 = 5, tags : Array(String) = [] of String do
public : Bool = true, expires : Int32 = 5, tags : Array(String) = [] of String, cache_etag : String? = nil,
cache_modified : Time? = nil do
include JSON::Serializable

def expires
Expand Down Expand Up @@ -213,7 +214,8 @@ module PlaceOS::Api
upload = ::PlaceOS::Model::Upload.create!(uploaded_by: user_id, uploaded_email: user_email, file_name: file_name, file_size: info.file_size, file_md5: info.file_id,
file_path: info.file_path, storage_id: storage.id, permissions: info.permissions,
object_key: object_key, object_options: object_options, public: info.public,
resumable: signer.multipart?, tags: info.tags)
resumable: signer.multipart?, tags: info.tags, cache_etag: info.cache_etag,
cache_modified: info.cache_modified)

{type: (signer.multipart? ? :chunked_upload : :direct_upload), signature: s3, upload_id: upload.id, residence: signer.name}
end
Expand Down
Loading