Skip to content

Commit

Permalink
check that file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Kostya Bats authored and kbats183 committed Mar 23, 2024
1 parent a074863 commit 31819e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/backend/src/main/kotlin/org/icpclive/admin/Routing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import org.icpclive.cds.tunning.toAdvancedProperties
import org.icpclive.data.Controllers
import org.icpclive.data.DataBus
import org.icpclive.util.sendFlow
import java.io.IOException
import java.nio.file.Files
import kotlin.io.path.notExists

fun Route.configureAdminApiRouting() {
authenticate("admin-api-auth") {
Expand Down Expand Up @@ -99,10 +99,10 @@ fun Route.configureAdminApiRouting() {

route("/advancedJson") {
get {
try {
call.respondFile(Config.cdsSettings.advancedJsonPath.toFile())
} catch (e: IOException) {
if (Config.cdsSettings.advancedJsonPath.notExists()) {
call.respondText("{}")
} else {
call.respondFile(Config.cdsSettings.advancedJsonPath.toFile())
}
}
post {
Expand Down

0 comments on commit 31819e2

Please sign in to comment.