File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
src/main/kotlin/server/endpoints/files Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import server.error.Errors
1515import server.response.respondFailure
1616import storage.Storage
1717import utils.ImageUtils
18+ import utils.jsonOf
1819
1920object DownloadFileEndpoint : EndpointBase(" /download/{uuid}" ) {
2021 override suspend fun PipelineContext <Unit , ApplicationCall >.endpoint () {
@@ -23,7 +24,15 @@ object DownloadFileEndpoint : EndpointBase("/download/{uuid}") {
2324 val width = call.parameters[" width" ]?.toIntOrNull()
2425 val height = call.parameters[" height" ]?.toIntOrNull()
2526
26- val file = Storage .find(uuid) ? : return respondFailure(Errors .FileNotFound )
27+ val file = Storage .find(uuid) ? : return respondFailure(
28+ Errors .FileNotFound .withExtra(
29+ jsonOf(
30+ " ImagesDir" to Storage .ImagesDir .absolutePath,
31+ " TracksDir" to Storage .TracksDir .absolutePath,
32+ " uuid" to uuid
33+ )
34+ )
35+ )
2736
2837 // Add the file's MIME type to the response
2938 withContext(Dispatchers .IO ) {
Original file line number Diff line number Diff line change @@ -58,7 +58,15 @@ object RequestFileEndpoint : EndpointBase("/file/{uuids}") {
5858 }
5959 )
6060 } catch (_: FileNotFoundException ) {
61- respondFailure(Errors .FileNotFound )
61+ respondFailure(
62+ Errors .FileNotFound .withExtra(
63+ jsonOf(
64+ " ImagesDir" to Storage .ImagesDir .absolutePath,
65+ " TracksDir" to Storage .TracksDir .absolutePath,
66+ " list" to list
67+ )
68+ )
69+ )
6270 }
6371 }
6472}
You can’t perform that action at this time.
0 commit comments