diff options
author | Marvin Borner | 2019-04-15 15:21:23 +0200 |
---|---|---|
committer | Marvin Borner | 2019-04-15 15:21:23 +0200 |
commit | a2a12a1ccb32812fed425333843205697694c236 (patch) | |
tree | 58cc04985197d6f3a8bec92bdbe14adb91a7c699 /src/main/kotlin/App.kt | |
parent | 7ec0252d24e068fd63fe2dc35c8d1364dc58dba9 (diff) |
Added deletion of files from database
Diffstat (limited to 'src/main/kotlin/App.kt')
-rw-r--r-- | src/main/kotlin/App.kt | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/kotlin/App.kt b/src/main/kotlin/App.kt index d95c887..a96aabe 100644 --- a/src/main/kotlin/App.kt +++ b/src/main/kotlin/App.kt @@ -308,9 +308,11 @@ fun setup(ctx: Context) { * Deletes the requested file */ fun delete(ctx: Context) { - if (getVerifiedUserId(ctx) > 0) { - File("$fileHome/${getVerifiedUserId(ctx)}/${ctx.splats()[0]}").delete() - // TODO: delete from database + val userId = getVerifiedUserId(ctx) + if (userId > 0) { + val path = "$fileHome/$userId/${ctx.splats()[0]}" + File(path).delete() + databaseController.deleteFile(path, userId) } } |