mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
Overwrite files on import
This commit is contained in:
@@ -33,6 +33,8 @@ import java.io.InputStream;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||||
|
|
||||||
class FileBasedStoreEntryImporter implements StoreEntryImporter {
|
class FileBasedStoreEntryImporter implements StoreEntryImporter {
|
||||||
|
|
||||||
private final Path directory;
|
private final Path directory;
|
||||||
@@ -50,7 +52,7 @@ class FileBasedStoreEntryImporter implements StoreEntryImporter {
|
|||||||
public void importEntry(String name, InputStream stream) {
|
public void importEntry(String name, InputStream stream) {
|
||||||
Path filePath = directory.resolve(name);
|
Path filePath = directory.resolve(name);
|
||||||
try {
|
try {
|
||||||
Files.copy(stream, filePath);
|
Files.copy(stream, filePath, REPLACE_EXISTING);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ImportFailedException(
|
throw new ImportFailedException(
|
||||||
ContextEntry.ContextBuilder.noContext(),
|
ContextEntry.ContextBuilder.noContext(),
|
||||||
|
|||||||
Reference in New Issue
Block a user