Maybe, Fix Schematics Readers

This commit is contained in:
2024-12-03 22:43:14 +01:00
parent 57d4727f35
commit 0134ef1f61
18 changed files with 1010 additions and 125 deletions

View File

@@ -88,7 +88,7 @@ fun Route.configureSchematic() {
return@get
}
call.response.header("Content-Disposition", "attachment; filename=\"${node.name}.${if (data.nodeFormat) "schem" else "schematic"}\"")
call.response.header("Content-Disposition", "attachment; filename=\"${node.name}${data.nodeFormat.fileEnding}\"")
call.respondBytes(data.schemData().readAllBytes(), contentType = ContentType.Application.OctetStream, status = HttpStatusCode.OK)
}
get("/info") {
@@ -118,8 +118,8 @@ fun Route.configureSchematic() {
node = SchematicNode.createSchematic(user.id, schemName, 0)
}
val data = NodeData(node.id, false)
data.saveFromStream(content.inputStream(), schemType == "schem")
val data = NodeData(node.id, NodeData.SchematicFormat.V2)
data.saveFromStream(content.inputStream(), NodeData.SchematicFormat.V2)
call.respond(ResponseSchematic(node))
}