Skip to content
Kona

Public disk and URLs

The public disk holds files browsers may fetch. Scaffolded apps prepend ServePublicStorage so GET /storage/... reads from that disk and returns a binary file response (see Request & response).

Create the symlink static tooling expects:

Terminal window
./grind storage:link

That links src/main/resources/public/storage → storage/app/public (or public/storage when the resources public folder is absent).

Register how temporary links are built (usually UrlGenerator.signed), then call temporaryUrl:

val files = app.resolve(FilesystemManager::class.java)
val urls = app.resolve(UrlGenerator::class.java)
files.buildTemporaryUrlsUsing("public") { url, exp -> urls.signed(url, exp) }
val link = files.temporaryUrl("avatars/a.png", 600, "public")
// or pass a signer inline:
val link2 = files.temporaryUrl("avatars/a.png", 600, { url, exp -> urls.signed(url, exp) }, "public")

providesTemporaryUrls("public") is true after a builder is registered (or the adapter itself was given one via LocalAdapter.buildTemporaryUrlsUsing). Protect download routes with ValidateSignature — see URL generation.