Skip to content

Commit

Permalink
GH-2046 Replace invalid copy operation with move in FileSystemStorage…
Browse files Browse the repository at this point in the history
…Provider#putFile impl (Fix #2046)
  • Loading branch information
dzikoysk committed Feb 4, 2024
1 parent 302a824 commit 136bd8e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import com.reposilite.storage.type
import io.javalin.http.ContentType
import io.javalin.http.ContentType.APPLICATION_OCTET_STREAM
import io.javalin.http.HttpStatus.INSUFFICIENT_STORAGE
import panda.std.Result
import panda.std.asSuccess
import java.io.File
import java.io.IOException
import java.io.InputStream
Expand All @@ -50,6 +48,8 @@ import java.nio.file.StandardCopyOption.REPLACE_EXISTING
import java.nio.file.attribute.FileTime
import kotlin.io.path.absolutePathString
import kotlin.streams.asSequence
import panda.std.Result
import panda.std.asSuccess

/**
* @param rootDirectory root directory of storage space
Expand Down Expand Up @@ -84,7 +84,7 @@ abstract class FileSystemStorageProvider protected constructor(

do {
try {
Files.copy(temporaryFile.toPath(), file, REPLACE_EXISTING)
Files.move(temporaryFile.toPath(), file, REPLACE_EXISTING)
} catch (e: NoSuchFileException) {
// Concurrent Files.move calls may throw
// ~ https://github.com/dzikoysk/reposilite/issues/1975
Expand Down

0 comments on commit 136bd8e

Please sign in to comment.