diff --git a/shard.lock b/shard.lock index 4739f781..0fb6a9dc 100644 --- a/shard.lock +++ b/shard.lock @@ -247,7 +247,7 @@ shards: placeos-core: git: https://github.com/placeos/core.git - version: 4.11.10+git.commit.2f03b1ede7c15da99201c7caadb9f50f885c71b2 + version: 4.11.10+git.commit.2e0f5200df837913a5d9c75b5b7c13d7c2a84eb8 placeos-core-client: # Overridden git: https://github.com/placeos/core-client.git @@ -267,7 +267,7 @@ shards: placeos-models: git: https://github.com/placeos/models.git - version: 9.37.4 + version: 9.38.2 placeos-resource: git: https://github.com/place-labs/resource.git diff --git a/src/constants.cr b/src/constants.cr index 3244ebd7..e51e8e14 100644 --- a/src/constants.cr +++ b/src/constants.cr @@ -36,6 +36,10 @@ module PlaceOS::Api OPENAI_API_MODEL = ENV["OPENAI_API_MODEL"]? || "gpt-4-1106-preview" OPENAI_MAX_TOKENS = ENV["OPENAI_MAX_TOKENS"]?.try(&.to_i) || 11264 + # Upload temporary links + TEMP_LINK_MAX_MINUTES = ENV["TEMP_LINK_MAX_MINUTES"]?.try(&.to_i) || 1440 + TEMP_LINK_DEFAULT_MINUTES = ENV["TEMP_LINK_DEFAULT_MINUTES"]?.try(&.to_i) || TEMP_LINK_MAX_MINUTES + # CHANGELOG ################################################################################################# diff --git a/src/placeos-rest-api/controllers/uploads.cr b/src/placeos-rest-api/controllers/uploads.cr index 8f4cdb22..bcdd33b0 100644 --- a/src/placeos-rest-api/controllers/uploads.cr +++ b/src/placeos-rest-api/controllers/uploads.cr @@ -133,9 +133,10 @@ module PlaceOS::Api @[AC::Route::GET("/:id/url")] def get_link( @[AC::Param::Info(description: "Link expiry period in minutes.", example: "60")] - expiry : Int32 = 1440 + expiry : Int32 = TEMP_LINK_DEFAULT_MINUTES ) - expiry = expiry > 1440 ? 1440 : expiry + max_expiry = TEMP_LINK_MAX_MINUTES + expiry = expiry > max_expiry ? max_expiry : expiry unless storage = current_upload.storage Log.warn { {message: "upload object associated storage not found", upload_id: current_upload.id, authority: authority.id, user: current_user.id} } raise Error::NotFound.new("Upload missing associated storage")