Skip to content

Commit 987baf0

Browse files
committed
fix(uploads): simple download glob fix
lucky_router latest release does not work with globs properly
1 parent 42e20e2 commit 987baf0

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

OPENAPI_DOC.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18540,7 +18540,7 @@ paths:
1854018540
application/json:
1854118541
schema:
1854218542
$ref: '#/components/schemas/PlaceOS__Api__Application__ContentError'
18543-
/api/engine/v2/uploads/{id}/download/{api_key}/{file_name}:
18543+
/api/engine/v2/uploads/{id}/download/{api_key}/{inline}/{file_name}:
1854418544
get:
1854518545
summary: a traditional looking route for downloading files
1854618546
description: 'a traditional looking route for downloading files
@@ -18563,9 +18563,13 @@ paths:
1856318563
required: true
1856418564
schema:
1856518565
type: string
18566+
- name: inline
18567+
in: path
18568+
required: true
18569+
schema:
18570+
type: boolean
1856618571
- name: file_name
1856718572
in: query
18568-
required: true
1856918573
schema:
1857018574
type: string
1857118575
responses:

shard.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ shards:
141141
git: https://github.com/spider-gazelle/crystal-loki-client.git
142142
version: 0.1.0+git.commit.ed3c0ab5b6f3da6103f6aed680fdcd171680feca
143143

144-
lucky_router:
144+
lucky_router: # Overridden
145145
git: https://github.com/luckyframework/lucky_router.git
146-
version: 0.6.0
146+
version: 0.6.0+git.commit.670df15727fc0a7b0ac8749dc0be75b59b8f174b
147147

148148
murmur3:
149149
git: https://github.com/aca-labs/murmur3.git

shard.override.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ dependencies:
99
github: place-labs/CrystalEmail
1010
version: ~> 0.2
1111

12-
opentelemetry-sdk:
13-
github: wyhaines/opentelemetry-sdk.cr
12+
lucky_router:
13+
github: luckyframework/lucky_router
1414
branch: main
1515

1616
# For core client

src/placeos-rest-api/controllers/uploads.cr

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,17 @@ module PlaceOS::Api
283283
# a traditional looking route for downloading files
284284
#
285285
# the API key route param can be Base64 encoded.
286-
@[AC::Route::GET("/:id/download/:api_key/*:file_name")]
287-
def download_simple_route(api_key : String, file_name : String)
286+
@[AC::Route::GET("/:id/download/:api_key/:inline/*:file_name")]
287+
def download_simple_route(api_key : String, inline : Bool, file_name : String = "file")
288288
# decode the API key
289289
api_key = Base64.decode_string(api_key).strip rescue api_key
290290

291291
# check api key
292292
request.headers["X-API-Key"] = api_key
293293
authorize!
294+
set_user_id
294295

295-
response.headers["Content-Disposition"] = %(attachment; filename="#{file_name}")
296+
response.headers["Content-Disposition"] = %(attachment; filename="#{file_name}") if inline
296297
download_proxy_file_contents
297298
end
298299

0 commit comments

Comments
 (0)