softwaremill / softwaremill/tapir
[BUG] File in multipart request is saved on disk and not deleted
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.5k
- Forks
- 468
- Avg merge
- 5h 37m
- Merged PRs (30d)
- 34
Description
Tapir version: zio-vertx-1.1.1
Scala version: 2.13.8
Files regardless of their size are saved on disk and not deleted after request is completed. Had to delete them manually
They are saved in folder in project root ./file-uploads
code to reproduce:
import io.vertx.core.Vertx
import io.vertx.ext.web.Router
import sttp.model.Part
import sttp.tapir.generic.auto._
import sttp.tapir.plainBody
import sttp.tapir.server.vertx.zio.VertxZioServerInterpreter
import sttp.tapir.server.vertx.zio.VertxZioServerInterpreter._
import sttp.tapir.ztapir._
import zio._
object Short extends zio.App {
implicit val runtime = zio.Runtime.default
case class TestRequest(test: String, file: Part[File])
val responseEndpoint =
endpoint
.in("test")
.in(multipartBody[TestRequest])
.out(plainBody[String])
val attach = VertxZioServerInterpreter[ZEnv]().route(responseEndpoint.zServerLogic(req => ZIO.succeed(req.test)))
def run(args: List[String]): URIO[ZEnv, ExitCode] =
ZManaged
.make(ZIO.effect {
val vertx = Vertx.vertx()
val server = vertx.createHttpServer()
val router = Router.router(vertx)
attach(router)
server.requestHandler(router).listen(9099)
} flatMap (_.asRIO)) { server =>
ZIO.effect(server.close()).flatMap(_.asRIO).orDie
}
.useForever
.exitCode
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Scala reproduction with Tapir zio-vertx 1.1.1 and inspect multipart handling in VertxZioServerInterpreter. Confirm where uploaded files are created and whether request completion triggers cleanup. Done means temporary files under ./file-uploads are deleted after the multipart request completes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100